Skip to content

Commit

Permalink
FinitePointTest: Extends Unit-Test
Browse files Browse the repository at this point in the history
... to cover the Equals methods.

Resolves: No entry
  • Loading branch information
shinji-san committed Aug 11, 2023
1 parent d5eb809 commit 3f52938
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions tests/FinitePointTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------

#region License

// ----------------------------------------------------------------------------
// Copyright 2019 Sebastian Walther
//
Expand All @@ -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
Expand Down Expand Up @@ -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<BigInteger>(FinitePointTextRepresentation1);
var finitePointUnderTest2 = new FinitePoint<BigInteger>(FinitePointTextRepresentation1);

// Act
bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2);

// Assert
Assert.True(actual);
}

[Fact]
public void Equals_FinitePointToDifferentFinitePoint_ReturnsFalse()
{
// Arrange
var finitePointUnderTest1 = new FinitePoint<BigInteger>(FinitePointTextRepresentation1);
var finitePointUnderTest2 = new FinitePoint<BigInteger>(FinitePointTextRepresentation2);

// Act
bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2);

// Assert
Assert.False(actual);
}

[Fact]
public void Equals_FinitePointToNull_ReturnsFalse()
{
// Arrange
var finitePointUnderTest1 = new FinitePoint<BigInteger>(FinitePointTextRepresentation1);

// Act
bool actual = finitePointUnderTest1.Equals(null);

// Assert
Assert.False(actual);
}

[Fact]
public void Equals_FinitePointToSameFinitePointAsObject_ReturnsTrue()
{
// Arrange
var finitePointUnderTest1 = new FinitePoint<BigInteger>(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<BigInteger>(FinitePointTextRepresentation1);
object finitePointUnderTest2 = new FinitePoint<BigInteger>(FinitePointTextRepresentation2);

// Act
bool actual = finitePointUnderTest1.Equals(finitePointUnderTest2);

// Assert
Assert.False(actual);
}
}
}

0 comments on commit 3f52938

Please sign in to comment.