Skip to content

Commit

Permalink
Since this is now a record, the equality operators are compiler gener…
Browse files Browse the repository at this point in the history
…ated

Still spot-checking a few arbitrary values for completeness
  • Loading branch information
dodexahedron committed Jan 19, 2024
1 parent 4b64756 commit efed19d
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions UnitTests/Drawing/ColorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,28 +151,21 @@ public void Color_ExplicitOperator_ToColorNames ()



[Fact]
public void Color_EqualityOperator_WithColorAndColor ()
{
// Arrange
var color1 = new Color (255, 128, 64, 32);
var color2 = new Color (255, 128, 64, 32);

// Act & Assert
Assert.True (color1 == color2);
Assert.False (color1 != color2);
}

[Fact]
public void Color_InequalityOperator_WithColorAndColor ()
[Theory]
[CombinatorialData]
public void Color_GeneratedEqualityOperators ( [CombinatorialValues ( 0, short.MaxValue, int.MaxValue, uint.MaxValue )] uint u1, [CombinatorialValues ( 0, short.MaxValue, int.MaxValue, uint.MaxValue )] uint u2 )
{
// Arrange
var color1 = new Color (255, 128, 64, 32);
var color2 = new Color (128, 64, 32, 16);
Color color1 = u1;
Color color2 = u2;

// Act & Assert
Assert.False (color1 == color2);
Assert.True (color1 != color2);
if ( u1 == u2 ) {
Assert.True ( color1 == color2 );
Assert.False ( color1 != color2 );
}
else {
Assert.True ( color1 != color2 );
Assert.False ( color1 == color2 );
}
}

[Fact]
Expand Down

0 comments on commit efed19d

Please sign in to comment.