|
|
|
@ -232,23 +232,24 @@ namespace ImageSharp.Tests.Colorspaces |
|
|
|
Assert.False(equal); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(EqualityData))] |
|
|
|
public void EqualityOperator(object first, object second, Type type) |
|
|
|
{ |
|
|
|
// 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 equal = firstObject == secondObject; |
|
|
|
|
|
|
|
// Assert
|
|
|
|
Assert.True(equal); |
|
|
|
} |
|
|
|
// TODO:Disabled due to RuntypeBinder errors while structs are internal
|
|
|
|
//[Theory]
|
|
|
|
//[MemberData(nameof(EqualityData))]
|
|
|
|
//public void EqualityOperator(object first, object second, Type type)
|
|
|
|
//{
|
|
|
|
// // 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 equal = firstObject == secondObject;
|
|
|
|
|
|
|
|
// // Assert
|
|
|
|
// Assert.True(equal);
|
|
|
|
//}
|
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(NotEqualityData))] |
|
|
|
@ -268,41 +269,42 @@ namespace ImageSharp.Tests.Colorspaces |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO:Disabled due to RuntypeBinder errors while structs are internal
|
|
|
|
//[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);
|
|
|
|
//}
|
|
|
|
|
|
|
|
// TODO:Disabled due to RuntypeBinder errors while structs are internal
|
|
|
|
//[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);
|
|
|
|
//}
|
|
|
|
} |
|
|
|
} |
|
|
|
|