/// <include file='Times.xdoc' path='docs/doc[@for="Times.Between"]/*'/> public static Times Between(int callCountFrom, int callCountTo, Range rangeKind) { if (rangeKind == Range.Exclusive) { Guard.NotOutOfRangeExclusive(callCountFrom, 0, callCountTo, nameof(callCountFrom)); if (callCountTo - callCountFrom == 1) { throw new ArgumentOutOfRangeException("callCountTo"); } return(new Times( c => c > callCountFrom && c < callCountTo, callCountFrom, callCountTo, Resources.NoMatchingCallsBetweenExclusive)); } Guard.NotOutOfRangeInclusive(callCountFrom, 0, callCountTo, nameof(callCountFrom)); return(new Times( c => c >= callCountFrom && c <= callCountTo, callCountFrom, callCountTo, Resources.NoMatchingCallsBetweenInclusive)); }
/// <include file='Times.xdoc' path='docs/doc[@for="Times.AtMost"]/*'/> public static Times AtMost(int callCount) { Guard.NotOutOfRangeInclusive(callCount, 0, int.MaxValue, nameof(callCount)); return(new Times(c => c >= 0 && c <= callCount, 0, callCount, Resources.NoMatchingCallsAtMost)); }
/// <include file='Times.xdoc' path='docs/doc[@for="Times.AtLeast"]/*'/> public static Times AtLeast(int callCount) { Guard.NotOutOfRangeInclusive(() => callCount, callCount, 1, int.MaxValue); return(new Times(c => c >= callCount, callCount, int.MaxValue, Resources.NoMatchingCallsAtLeast)); }
/// <include file='Times.xdoc' path='docs/doc[@for="Times.Exactly"]/*'/> public static Times Exactly(int callCount) { Guard.NotOutOfRangeInclusive(callCount, 0, int.MaxValue, nameof(callCount)); return(new Times(c => c == callCount, callCount, callCount, Resources.NoMatchingCallsExactly)); }
public static Times MultiplyOf(int num) { Guard.NotOutOfRangeInclusive(() => num, num, 0, int.MaxValue); return(new Times(c => (c % num) == 0, num, num, Resources.NoMatchingCallsExactly)); }