diff --git a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs index c8a3cf38d0..af948fa21a 100644 --- a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs @@ -148,8 +148,8 @@ namespace ImageSharp.Tests.Colors // 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 :) - var firstObject = Convert.ChangeType(first, type); - var secondObject = Convert.ChangeType(second, type); + dynamic firstObject = Convert.ChangeType(first, type); + dynamic secondObject = Convert.ChangeType(second, type); // Act var equal = firstObject.Equals(secondObject); @@ -166,8 +166,8 @@ namespace ImageSharp.Tests.Colors // 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 :) - var firstObject = Convert.ChangeType(first, type); - var secondObject = Convert.ChangeType(second, type); + dynamic firstObject = Convert.ChangeType(first, type); + dynamic secondObject = Convert.ChangeType(second, type); // Act var equal = firstObject.Equals(secondObject); @@ -175,5 +175,41 @@ namespace ImageSharp.Tests.Colors // Assert 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 + var equal = firstObject == secondObject; + + // Assert + Assert.True(equal); + } + + [Theory] + [MemberData(nameof(NotEqualityData))] + public void NotEqualityOperator(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 + var notEqual = firstObject != secondObject; + + // Assert + Assert.True(notEqual); + } } }