Exemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CurrentValuePropertyCheck{TValue}" /> class.
 /// </summary>
 /// <param name="property">The property store to check.</param>
 /// <param name="name">A name that can be used to identify the check in its verification group.</param>
 /// <param name="expectedValue">The expected value.</param>
 /// <param name="comparer">Optional parameter with a comparer used to verify that the values are equal.</param>
 public CurrentValuePropertyCheck(IStoredProperty <TValue> property, string?name, TValue expectedValue,
                                  IEqualityComparer <TValue>?comparer = null)
 {
     _name          = name;
     _property      = property ?? throw new ArgumentNullException(nameof(property));
     _expectedValue = expectedValue;
     _comparer      = comparer ?? EqualityComparer <TValue> .Default;
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Checks the current values in the property store. Adds the check to the verification group provided.
 /// </summary>
 /// <typeparam name="TValue">The type of the property.</typeparam>
 /// <param name="property">The <see cref="IStoredProperty{TValue}" /> whose value 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="expectedValue">The expected value. </param>
 /// <param name="comparer">Optional parameter with a comparer used to verify that the values are equal.</param>
 /// <returns>The <see cref="IStoredProperty{TValue}" /> instance that can be used to add further checks.</returns>
 public static IStoredProperty <TValue> CurrentValueCheck <TValue>(this IStoredProperty <TValue> property, VerificationGroup collector,
                                                                   string?name, TValue expectedValue, IEqualityComparer <TValue>?comparer = null)
 {
     collector.Add(new CurrentValuePropertyCheck <TValue>(property, name, expectedValue, comparer));
     return(property);
 }