From 9bb9c9692af8dfce0a183a24f68b2f1a077e19d8 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 28 Mar 2023 16:09:35 +0100 Subject: [PATCH] tests: 100% coverage on Circle and CircleF --- X10D.Tests/src/Drawing/CircleFTests.cs | 16 ++++++++++++++++ X10D.Tests/src/Drawing/CircleTests.cs | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/X10D.Tests/src/Drawing/CircleFTests.cs b/X10D.Tests/src/Drawing/CircleFTests.cs index cad0907..d8e8256 100644 --- a/X10D.Tests/src/Drawing/CircleFTests.cs +++ b/X10D.Tests/src/Drawing/CircleFTests.cs @@ -73,6 +73,15 @@ public class CircleFTests Assert.IsFalse(unitCircle1 != unitCircle2); } + [TestMethod] + public void Equals_ShouldBeTrue_GivenUnitCirclesAsObjects() + { + CircleF unitCircle1 = CircleF.Unit; + object unitCircle2 = CircleF.Unit; + Assert.AreEqual(unitCircle1, unitCircle2); + Assert.IsTrue(unitCircle1.Equals(unitCircle2)); + } + [TestMethod] public void Equals_ShouldBeFalse_GivenDifferentCircles() { @@ -81,6 +90,13 @@ public class CircleFTests Assert.IsTrue(CircleF.Unit != CircleF.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.AreNotEqual((object?)null, CircleF.Empty); + Assert.IsFalse(CircleF.Empty.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyCircle() { diff --git a/X10D.Tests/src/Drawing/CircleTests.cs b/X10D.Tests/src/Drawing/CircleTests.cs index ae9214e..3151299 100644 --- a/X10D.Tests/src/Drawing/CircleTests.cs +++ b/X10D.Tests/src/Drawing/CircleTests.cs @@ -73,6 +73,15 @@ public class CircleTests Assert.IsFalse(unitCircle1 != unitCircle2); } + [TestMethod] + public void Equals_ShouldBeTrue_GivenUnitCirclesAsObjects() + { + Circle unitCircle1 = Circle.Unit; + object unitCircle2 = Circle.Unit; + Assert.AreEqual(unitCircle1, unitCircle2); + Assert.IsTrue(unitCircle1.Equals(unitCircle2)); + } + [TestMethod] public void Equals_ShouldBeFalse_GivenDifferentCircles() { @@ -81,6 +90,13 @@ public class CircleTests Assert.IsTrue(Circle.Unit != Circle.Empty); } + [TestMethod] + public void Equals_ShouldBeFalse_GivenDifferentObjects() + { + Assert.AreNotEqual((object?)null, Circle.Empty); + Assert.IsFalse(Circle.Empty.Equals(null)); + } + [TestMethod] public void GetHashCode_ShouldBeCorrect_GivenEmptyCircle() {