public void ObjectWithListMatches() { var a = new ObjectWithList { Number = 2, String = "string", Decimal = 20.000000000000000000001, List = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }; var b = new ObjectWithList { Number = 2, String = "string", Decimal = 20.000000000000000000001, List = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }; var result = _calculator.Diff(a, b); Assert.True(result.ValuesMatch); }
public void ListIsTheSame() { var a = new List <string> { "hi", "there" }; var b = new List <string> { "hi", "there" }; var result = _calculator.Diff(a, b); Assert.True(result.ValuesMatch); }
public void NothingIsIgnoredWhenNothingIsSpecified() { var calculator = new DiffCalculator(); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); Assert.False(result.ValuesMatch); }
public void AClassIsIgnored() { var calculator = new DiffCalculator(ignoredClasses: new[] {typeof (double)}); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); var resultMatch = result.ValuesMatch; Assert.True(resultMatch); }
public void AClassIsNotIgnoredWhenItIsntDiffed() { var calculator = new DiffCalculator(ignoredClasses: new[] { typeof(decimal) }); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); Assert.False(result.ValuesMatch); }
public void IgnoresFieldsContainingByType() { var calculator = new DiffCalculator(ignoreFieldsContainingByType: new Dictionary<Type, string[]> { { typeof(SlightlyDifferentObject), new[] { "String" } } }); var a = new SlightlyDifferentObject(secondString: "hi"); var b = new SlightlyDifferentObject(secondString: "there"); var resultObject = calculator.Diff(a, b); Assert.True(resultObject.ValuesMatch); }
public void IgnoresFieldsContaining() { var calculator = new DiffCalculator( ignoreFieldsContaining: new[] { "String" }); var a = new SlightlyDifferentObject(secondString: "hi"); var b = new SlightlyDifferentObject(secondString: "there"); var resultObject = calculator.Diff(a, b); Assert.True(resultObject.ValuesMatch); }
public void ItemsFieldIsEmptySet() { var calculator = new DiffCalculator(ignoreMatches: true); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 1.1, 2.1, 3.1 }; var result = calculator.Diff(a, b); var items = ((ObjectDiff)result).Items; Assert.True(result.ValuesMatch); Assert.False(items.Any()); }
public void AllMatchesAreIgnored() { var calculator = new DiffCalculator(ignoreMatches: true); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 5.1, 2.1, 4.1 }; var result = calculator.Diff(a, b); var resultMatch = result.ValuesMatch; var items = ((ObjectDiff)result).Items; Assert.False(resultMatch); Assert.Equal(2, items.Count()); }
public void IgnoresFieldsContainingByType() { var calculator = new DiffCalculator(ignoreFieldsContainingByType: new Dictionary <Type, string[]> { { typeof(SlightlyDifferentObject), new[] { "String" } } }); var a = new SlightlyDifferentObject(secondString: "hi"); var b = new SlightlyDifferentObject(secondString: "there"); var resultObject = calculator.Diff(a, b); Assert.True(resultObject.ValuesMatch); }
public void MatchesAreNotIgnored() { var calculator = new DiffCalculator(ignoreMatches: false); var a = new List<double> { 1.1, 2.1, 3.1 }; var b = new List<double> { 1.1, 2.1, 3.1 }; var result = calculator.Diff(a, b); var items = ((ObjectDiff)result).Items; Assert.True(result.ValuesMatch); // Currently <= because there are some hidden fields included Assert.True(3 <= items.Count()); }
public void AClassIsNotIgnoredWhenItIsntDiffed() { var calculator = new DiffCalculator(ignoredClasses: new[] { typeof(decimal) }); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); Assert.False(result.ValuesMatch); }
public void NothingIsIgnoredWhenNothingIsSpecified() { var calculator = new DiffCalculator(); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); Assert.False(result.ValuesMatch); }
public void AClassIsIgnored() { var calculator = new DiffCalculator(ignoredClasses: new[] { typeof(double) }); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 5.1, 3.1, 4.1 }; var result = calculator.Diff(a, b); var resultMatch = result.ValuesMatch; Assert.True(resultMatch); }
public void ItemsFieldIsEmptySet() { var calculator = new DiffCalculator(ignoreMatches: true); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 1.1, 2.1, 3.1 }; var result = calculator.Diff(a, b); var items = ((ObjectDiff)result).Items; Assert.True(result.ValuesMatch); Assert.False(items.Any()); }
public void AllMatchesAreIgnored() { var calculator = new DiffCalculator(ignoreMatches: true); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 5.1, 2.1, 4.1 }; var result = calculator.Diff(a, b); var resultMatch = result.ValuesMatch; var items = ((ObjectDiff)result).Items; Assert.False(resultMatch); Assert.Equal(2, items.Count()); }
public void MatchesAreNotIgnored() { var calculator = new DiffCalculator(ignoreMatches: false); var a = new List <double> { 1.1, 2.1, 3.1 }; var b = new List <double> { 1.1, 2.1, 3.1 }; var result = calculator.Diff(a, b); var items = ((ObjectDiff)result).Items; Assert.True(result.ValuesMatch); // Currently <= because there are some hidden fields included Assert.True(3 <= items.Count()); }
public static BaseDiff DiffAgainst(this object baseObject, object antagonist) { var calculator = new DiffCalculator(); return calculator.Diff(baseObject, antagonist); }
public static BaseDiff DiffAgainst(this object baseObject, object antagonist) { var calculator = new DiffCalculator(); return(calculator.Diff(baseObject, antagonist)); }