From dd325ba5c91c95ed70defe2cf495d2290246f3b7 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 1 Apr 2023 00:30:51 +0100 Subject: [PATCH] test: test Equals(object) for various Drawing types This brings coverage to 100% for the affected types. --- X10D.Tests/src/Drawing/CuboidTests.cs | 6 ++++++ X10D.Tests/src/Drawing/EllipseFTests.cs | 6 ++++++ X10D.Tests/src/Drawing/EllipseTests.cs | 6 ++++++ X10D.Tests/src/Drawing/Line3DTests.cs | 6 ++++++ X10D.Tests/src/Drawing/LineFTests.cs | 6 ++++++ X10D.Tests/src/Drawing/LineTests.cs | 6 ++++++ X10D.Tests/src/Drawing/SphereTests.cs | 6 ++++++ 7 files changed, 42 insertions(+) diff --git a/X10D.Tests/src/Drawing/CuboidTests.cs b/X10D.Tests/src/Drawing/CuboidTests.cs index 3966af3..451a02b 100644 --- a/X10D.Tests/src/Drawing/CuboidTests.cs +++ b/X10D.Tests/src/Drawing/CuboidTests.cs @@ -40,6 +40,12 @@ public class CuboidTests Assert.IsTrue(Cuboid.Cube != Cuboid.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(Cuboid.Cube.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyCircle() { diff --git a/X10D.Tests/src/Drawing/EllipseFTests.cs b/X10D.Tests/src/Drawing/EllipseFTests.cs index 43d24a4..97b5af5 100644 --- a/X10D.Tests/src/Drawing/EllipseFTests.cs +++ b/X10D.Tests/src/Drawing/EllipseFTests.cs @@ -60,6 +60,12 @@ public class EllipseFTests Assert.IsTrue(EllipseF.Unit != EllipseF.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(EllipseF.Unit.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyEllipse() { diff --git a/X10D.Tests/src/Drawing/EllipseTests.cs b/X10D.Tests/src/Drawing/EllipseTests.cs index 83f37a6..c5482a3 100644 --- a/X10D.Tests/src/Drawing/EllipseTests.cs +++ b/X10D.Tests/src/Drawing/EllipseTests.cs @@ -51,6 +51,12 @@ public class EllipseTests Assert.IsTrue(Ellipse.Unit != Ellipse.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(Ellipse.Unit.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyEllipse() { diff --git a/X10D.Tests/src/Drawing/Line3DTests.cs b/X10D.Tests/src/Drawing/Line3DTests.cs index 32335d9..8cbc7cf 100644 --- a/X10D.Tests/src/Drawing/Line3DTests.cs +++ b/X10D.Tests/src/Drawing/Line3DTests.cs @@ -88,6 +88,12 @@ public class Line3DTests Assert.IsTrue(Line3D.One != Line3D.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(Line3D.One.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyLine() { diff --git a/X10D.Tests/src/Drawing/LineFTests.cs b/X10D.Tests/src/Drawing/LineFTests.cs index 24b5d10..582bde3 100644 --- a/X10D.Tests/src/Drawing/LineFTests.cs +++ b/X10D.Tests/src/Drawing/LineFTests.cs @@ -80,6 +80,12 @@ public class LineFTests Assert.IsTrue(LineF.One != LineF.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(LineF.One.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyLine() { diff --git a/X10D.Tests/src/Drawing/LineTests.cs b/X10D.Tests/src/Drawing/LineTests.cs index 6fce015..2a690e8 100644 --- a/X10D.Tests/src/Drawing/LineTests.cs +++ b/X10D.Tests/src/Drawing/LineTests.cs @@ -62,6 +62,12 @@ public class LineTests Assert.IsTrue(Line.One != Line.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(Line.One.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyLine() { diff --git a/X10D.Tests/src/Drawing/SphereTests.cs b/X10D.Tests/src/Drawing/SphereTests.cs index 32b321f..3457b35 100644 --- a/X10D.Tests/src/Drawing/SphereTests.cs +++ b/X10D.Tests/src/Drawing/SphereTests.cs @@ -66,6 +66,12 @@ public class SphereTests Assert.IsFalse(unitCircle1 != unitCircle2); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.IsFalse(Sphere.Unit.Equals(null)); + } + [TestMethod] public void Equals_ShouldBeFalse_GivenDifferentCircles() {