From 3f529384f7f6646f9ffc8809de014a691460bc1b Mon Sep 17 00:00:00 2001 From: Sebastian Walther Date: Sun, 30 Jul 2023 20:47:06 +0200 Subject: [PATCH] FinitePointTest: Extends Unit-Test ... to cover the Equals methods. Resolves: No entry --- tests/FinitePointTest.cs | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/FinitePointTest.cs b/tests/FinitePointTest.cs index a9a8d28..4d47475 100644 --- a/tests/FinitePointTest.cs +++ b/tests/FinitePointTest.cs @@ -7,6 +7,7 @@ // ---------------------------------------------------------------------------- #region License + // ---------------------------------------------------------------------------- // Copyright 2019 Sebastian Walther // @@ -27,6 +28,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + #endregion namespace SecretSharingDotNet.Test @@ -99,5 +101,74 @@ public void CompareTo_FinitePointToSameFinitePoint_ReturnsZero() // Assert Assert.Equal(0, actual); } + + [Fact] + public void Equals_FinitePointToSameFinitePoint_ReturnsTrue() + { + // Arrange + var finitePointUnderTest1 = new FinitePoint(FinitePointTextRepresentation1); + var finitePointUnderTest2 = new FinitePoint(FinitePointTextRepresentation1); + + // Act + bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2); + + // Assert + Assert.True(actual); + } + + [Fact] + public void Equals_FinitePointToDifferentFinitePoint_ReturnsFalse() + { + // Arrange + var finitePointUnderTest1 = new FinitePoint(FinitePointTextRepresentation1); + var finitePointUnderTest2 = new FinitePoint(FinitePointTextRepresentation2); + + // Act + bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2); + + // Assert + Assert.False(actual); + } + + [Fact] + public void Equals_FinitePointToNull_ReturnsFalse() + { + // Arrange + var finitePointUnderTest1 = new FinitePoint(FinitePointTextRepresentation1); + + // Act + bool actual = finitePointUnderTest1.Equals(null); + + // Assert + Assert.False(actual); + } + + [Fact] + public void Equals_FinitePointToSameFinitePointAsObject_ReturnsTrue() + { + // Arrange + var finitePointUnderTest1 = new FinitePoint(FinitePointTextRepresentation1); + object finitePointUnderTest2 = finitePointUnderTest1; + + // Act + bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2); + + // Assert + Assert.True(actual); + } + + [Fact] + public void Equals_FinitePointToDifferentFinitePointAsObject_ReturnsFalse() + { + // Arrange + var finitePointUnderTest1 = new FinitePoint(FinitePointTextRepresentation1); + object finitePointUnderTest2 = new FinitePoint(FinitePointTextRepresentation2); + + // Act + bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2); + + // Assert + Assert.False(actual); + } } }