Exemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CurrentValuesIndexerCheck{TKey, TValue}" /> class.
 /// </summary>
 /// <param name="indexer">The indexer store to check.</param>
 /// <param name="name">A name that can be used to identify the check in its verification group.</param>
 /// <param name="expectations">
 ///     A list of key-value pairs to check. The check will retrieve the value for each key
 ///     in the list and compare it to the value in the list.
 /// </param>
 /// <param name="comparer">Optional parameter with a comparer used to verify that the values are equal.</param>
 public CurrentValuesIndexerCheck(IStoredIndexer <TKey, TValue> indexer, string?name, IEnumerable <KeyValuePair <TKey, TValue> >?expectations,
                                  IEqualityComparer <TValue>?comparer = null)
 {
     _indexer      = indexer ?? throw new ArgumentNullException(nameof(indexer));
     _name         = name;
     _expectations = expectations ?? Enumerable.Empty <KeyValuePair <TKey, TValue> >();
     _comparer     = comparer ?? EqualityComparer <TValue> .Default;
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Checks the current values in the indexer store. Adds the check to the verification group provided.
 /// </summary>
 /// <typeparam name="TKey">The type of the indexer key.</typeparam>
 /// <typeparam name="TValue">The type of the indexer value.</typeparam>
 /// <param name="indexer">The <see cref="IStoredIndexer{TKey,TValue}" /> whose values to check.</param>
 /// <param name="collector">The verification group to which this check is added.</param>
 /// <param name="name">A name that can be used to identify the check in its verification group.</param>
 /// <param name="expectedValues">
 ///     A list of key-value pairs to check. The check will retrieve the value for each key
 ///     in the list and compare it to the value in the list.
 /// </param>
 /// <param name="comparer">Optional parameter with a comparer used to verify that the values are equal.</param>
 /// <returns>The <see cref="IStoredIndexer{TKey,TValue}" /> instance that can be used to add further checks.</returns>
 public static IStoredIndexer <TKey, TValue> CurrentValuesCheck <TKey, TValue>(this IStoredIndexer <TKey, TValue> indexer,
                                                                               VerificationGroup collector,
                                                                               string?name, IEnumerable <KeyValuePair <TKey, TValue> >?expectedValues, IEqualityComparer <TValue>?comparer = null)
 {
     collector.Add(new CurrentValuesIndexerCheck <TKey, TValue>(indexer, name, expectedValues, comparer));
     return(indexer);
 }