コード例 #1
0
        /// <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));
        }