Exemplo n.º 1
0
 /// <summary>
 ///   Matches any value that is present in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of possible 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 IsIn <TValue>(IEnumerable <TValue> items, IEqualityComparer <TValue> comparer)
 {
     return(Match <TValue> .Create(value => items.Contains(value, comparer), () => It.IsIn(items, comparer)));
 }
Exemplo n.º 2
0
 /// <summary>
 ///   Matches any value that is present in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of possible 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 a value of 1, 2, or 3.
 ///   <code>
 ///     mock.Setup(x => x.HasInventory(
 ///                         It.IsAny&lt;string&gt;(),
 ///                         It.IsIn(1, 2, 3)))
 ///         .Returns(false);
 ///   </code>
 /// </example>
 public static TValue IsIn <TValue>(params TValue[] items)
 {
     return(Match <TValue> .Create(value => items.Contains(value), () => It.IsIn(items)));
 }
Exemplo n.º 3
0
 /// <summary>
 ///   Matches any value that is present in the sequence specified.
 /// </summary>
 /// <param name="items">The sequence of possible 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 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.IsIn(values)))
 ///         .Returns(false);
 ///   </code>
 /// </example>
 public static TValue IsIn <TValue>(IEnumerable <TValue> items)
 {
     return(Match <TValue> .Create(value => items.Contains(value), () => It.IsIn(items)));
 }