Struct Times
- Namespace
- Moq
- Assembly
- Moq.dll
Defines the number of invocations allowed by a mocked method.
public readonly struct Times : IEquatable<Times>
- Implements
- Inherited Members
Methods
AtLeast(int)
Specifies that a mocked method should be invoked callCount times
as minimum.
public static Times AtLeast(int callCount)
Parameters
callCountintThe minimum number of times.
Returns
- Times
An object defining the allowed number of invocations.
AtLeastOnce()
Specifies that a mocked method should be invoked one time as minimum.
public static Times AtLeastOnce()
Returns
- Times
An object defining the allowed number of invocations.
AtMost(int)
Specifies that a mocked method should be invoked callCount times
as maximum.
public static Times AtMost(int callCount)
Parameters
callCountintThe maximum number of times.
Returns
- Times
An object defining the allowed number of invocations.
AtMostOnce()
Specifies that a mocked method should be invoked one time as maximum.
public static Times AtMostOnce()
Returns
- Times
An object defining the allowed number of invocations.
Between(int, int, Range)
Specifies that a mocked method should be invoked between
callCountFrom and callCountTo times.
public static Times Between(int callCountFrom, int callCountTo, Range rangeKind)
Parameters
callCountFromintThe minimum number of times.
callCountTointThe maximum number of times.
rangeKindRangeThe kind of range. See Range.
Returns
- Times
An object defining the allowed number of invocations.
Deconstruct(out int, out int)
Deconstructs this instance.
public void Deconstruct(out int from, out int to)
Parameters
fromintThis output parameter will receive the minimum required number of calls satisfying this instance (i.e. the lower inclusive bound).
tointThis output parameter will receive the maximum allowed number of calls satisfying this instance (i.e. the upper inclusive bound).
Equals(Times)
Returns a value indicating whether this instance is equal to a specified Times value.
public bool Equals(Times other)
Parameters
Returns
Equals(object)
Returns a value indicating whether this instance is equal to a specified Times value.
public override bool Equals(object obj)
Parameters
objobjectAn object to compare to this instance.
Returns
Exactly(int)
Specifies that a mocked method should be invoked exactly
callCount times.
public static Times Exactly(int callCount)
Parameters
callCountintThe times that a method or property can be called.
Returns
- Times
An object defining the allowed number of invocations.
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Never()
Specifies that a mocked method should not be invoked.
public static Times Never()
Returns
- Times
An object defining the allowed number of invocations.
Once()
Specifies that a mocked method should be invoked exactly one time.
public static Times Once()
Returns
- Times
An object defining the allowed number of invocations.
ToString()
public override string ToString()
Returns
Validate(int)
Checks whether the specified number of invocations matches the constraint described by this instance.
public bool Validate(int count)
Parameters
countintThe number of invocations to check.
Returns
Operators
operator ==(Times, Times)
Determines whether two specified Times objects have the same value.
public static bool operator ==(Times left, Times right)
Parameters
Returns
operator !=(Times, Times)
Determines whether two specified Times objects have different values.
public static bool operator !=(Times left, Times right)