Ejemplo n.º 1
0
 /// <summary>
 /// Clears the assemblies for field level equality testing.
 /// </summary>
 protected void ClearAssembliesWithTypesToPerformFieldValueEqualityOn()
 {
     FieldValueEqualityComparer.SetAssembliesWithTypesToUseValueSemanticsOn(new Assembly[0]);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets up comparison logging for the assemblies returned from <see cref="AssembliesWithTypesToPerformFieldValueEqualityOn"/>.
 /// </summary>
 protected void SetAssembliesWithTypesToPerformFieldValueEqualityOn()
 {
     FieldValueEqualityComparer.SetAssembliesWithTypesToUseValueSemanticsOn(AssembliesWithTypesToPerformFieldValueEqualityOn.ToList());
 }
Ejemplo n.º 3
0
 protected override void SetUpEachTest()
 {
     base.SetUpEachTest();
     FieldValueEqualityComparer.AddFieldValueEqualityComparer(new ProxyFieldValueEqualityComparer());
     FieldValueEqualityComparer.AddFieldValueTypeEqualityComparer(new ProxyFieldValueTypeEqualityComparer());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Asserts that the lists have the same instances in them by performing field comparisons.
 /// </summary>
 /// <typeparam name="T">The type of the instances.</typeparam>
 /// <param name="actualCollection">The actual collection to check.</param>
 /// <param name="expectedCollection">The collection of items expected to be found.</param>
 /// <returns>The actual list.</returns>
 public static IList <T> ShouldHaveSameValuesAs <T>(this IList <T> actualCollection, IList <T> expectedCollection)
 {
     Assert.IsTrue(FieldValueEqualityComparer.AreEqual(expectedCollection, actualCollection), FailedTestMessage);
     return(actualCollection);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Asserts that the instances do not have the same field values.
 /// </summary>
 /// <typeparam name="T">The type of the instances.</typeparam>
 /// <param name="actual">The instance to check.</param>
 /// <param name="expected">The expected instance to test against.</param>
 /// <returns>The actual instance supplied.</returns>
 public static T ShouldNotHaveSameValueAs <T>(this T actual, T expected)
 {
     Assert.IsFalse(FieldValueEqualityComparer.AreEqual(expected, actual), FailedTestMessageForSingleValues, expected, actual);
     return(actual);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Asserts that the instances have the same field values.
 /// </summary>
 /// <typeparam name="T">The type of the instances.</typeparam>
 /// <param name="actual">The instance to check.</param>
 /// <param name="expected">The expected instance to test against.</param>
 /// <param name="nullableDateTimeProperties">Any nullable date time properties to fuzzy check against.</param>
 /// <param name="dateTimeProperties">Any date time properties to fuzzy check against.</param>
 /// <returns>The actual instance supplied. If any fuzzy date times were supplied, they will now be set to match those of the entity in the database.</returns>
 public static T ShouldHaveSameValueAs <T>(this T actual, T expected, Expression <Func <T, DateTime?> >[] nullableDateTimeProperties, Expression <Func <T, DateTime> >[] dateTimeProperties)
 {
     AssertFuzzyDateEquals(actual, expected, nullableDateTimeProperties, dateTimeProperties);
     Assert.IsTrue(FieldValueEqualityComparer.AreEqual(expected, actual), FailedTestMessageForSingleValues, expected, actual);
     return(actual);
 }