|
|
|
@ -213,41 +213,5 @@ namespace ImageSharp.Tests.Colors |
|
|
|
// Assert
|
|
|
|
Assert.True(notEqual); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(AlmostEqualsData))] |
|
|
|
public void AlmostEquals(object first, object second, Type type, float precision) |
|
|
|
{ |
|
|
|
// Arrange
|
|
|
|
// Cast to the known object types, this is so that we can hit the
|
|
|
|
// equality operator on the concrete type, otherwise it goes to the
|
|
|
|
// default "object" one :)
|
|
|
|
dynamic firstObject = Convert.ChangeType(first, type); |
|
|
|
dynamic secondObject = Convert.ChangeType(second, type); |
|
|
|
|
|
|
|
// Act
|
|
|
|
dynamic almostEqual = firstObject.AlmostEquals(secondObject, precision); |
|
|
|
|
|
|
|
// Assert
|
|
|
|
Assert.True(almostEqual); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(AlmostNotEqualsData))] |
|
|
|
public void AlmostNotEquals(object first, object second, Type type, float precision) |
|
|
|
{ |
|
|
|
// Arrange
|
|
|
|
// Cast to the known object types, this is so that we can hit the
|
|
|
|
// equality operator on the concrete type, otherwise it goes to the
|
|
|
|
// default "object" one :)
|
|
|
|
dynamic firstObject = Convert.ChangeType(first, type); |
|
|
|
dynamic secondObject = Convert.ChangeType(second, type); |
|
|
|
|
|
|
|
// Act
|
|
|
|
dynamic almostEqual = firstObject.AlmostEquals(secondObject, precision); |
|
|
|
|
|
|
|
// Assert
|
|
|
|
Assert.False(almostEqual); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|