Пример #1
0
Файл: It.cs Проект: belav/moq4
 /// <summary>
 ///   Matches any value that is not found in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of disallowed values.</param>
 /// <param name="comparer">An <see cref="IEqualityComparer{T}"/> with which the values should be compared.</param>
 /// <typeparam name="TValue">Type of the argument to check.</typeparam>
 public static TValue IsNotIn <TValue>(
     IEnumerable <TValue> items,
     IEqualityComparer <TValue> comparer
     )
 {
     return(Match <TValue> .Create(
                value => !items.Contains(value, comparer),
                () => It.IsNotIn(items, comparer)
                ));
 }
Пример #2
0
 /// <summary>
 ///   Matches any value that is not found in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of disallowed values.</param>
 /// <typeparam name="TValue">Type of the argument to check.</typeparam>
 /// <example>
 ///   The following example shows how to expect a method call with an integer argument
 ///   of any value except 1, 2, or 3.
 ///   <code>
 ///     mock.Setup(x => x.HasInventory(
 ///                         It.IsAny&lt;string&gt;(),
 ///                         It.IsNotIn(1, 2, 3)))
 ///         .Returns(false);
 ///   </code>
 /// </example>
 public static TValue IsNotIn <TValue>(params TValue[] items)
 {
     return(Match <TValue> .Create(value => !items.Contains(value), () => It.IsNotIn(items)));
 }
Пример #3
0
 /// <summary>
 ///   Matches any value that is not found in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of disallowed values.</param>
 /// <typeparam name="TValue">Type of the argument to check.</typeparam>
 /// <example>
 ///   The following example shows how to expect a method call with an integer argument
 ///   with value not found from a list.
 ///   <code>
 ///     var values = new List&lt;int&gt; { 1, 2, 3 };
 ///
 ///     mock.Setup(x => x.HasInventory(
 ///                         It.IsAny&lt;string&gt;(),
 ///                         It.IsNotIn(values)))
 ///         .Returns(false);
 ///   </code>
 /// </example>
 public static TValue IsNotIn <TValue>(IEnumerable <TValue> items)
 {
     return(Match <TValue> .Create(value => !items.Contains(value), () => It.IsNotIn(items)));
 }