Example #1
0
 /// <summary>Verifies two objects are equal by value.</summary>
 /// <param name="expected">Object to compare against.</param>
 /// <param name="details">Optional failure details.</param>
 /// <returns>Chainer to make additional assertions with.</returns>
 /// <exception cref="AssertException">If the expected behavior doesn't happen.</exception>
 public virtual AssertChainer <T> ValuesEqual(object expected, string details = null)
 {
     Difference[] differences = Valuer.Compare(expected, Actual).ToArray();
     if (differences.Length > 0)
     {
         throw new AssertException($"Value equality failed for type '{GetTypeName(expected)}'.",
                                   details, Gen.InitialSeed, string.Join <Difference>(Environment.NewLine, differences));
     }
     return(ToChainer());
 }
Example #2
0
 /// <summary>Verifies two objects are unequal by value.</summary>
 /// <param name="expected">Object to compare against.</param>
 /// <param name="details">Optional failure details.</param>
 /// <returns>Chainer to make additional assertions with.</returns>
 /// <exception cref="AssertException">If the expected behavior doesn't happen.</exception>
 public virtual AssertChainer <T> ValuesNotEqual(object expected, string details = null)
 {
     if (!Valuer.Compare(expected, Actual).Any())
     {
         throw new AssertException(
                   $"Value inequality failed for type '{GetTypeName(expected)}'.",
                   details, Gen.InitialSeed, expected?.ToString());
     }
     return(ToChainer());
 }