Skip to content

Commit ebc1ee1

Browse files
committed
added tests
1 parent 1919d31 commit ebc1ee1

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/PolylineAlgorithm.Abstraction.Tests/PolylineEncoderTest.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ public class PolylineEncoderTest {
1010

1111
public static IEnumerable<object[]> CoordinateCount => [[1], [10], [100], [1_000]];
1212

13+
public static IEnumerable<(double, double)> NotANumberAndInfinityCoordinates => StaticValueProvider.Invalid.GetNotANumberAndInfinityCoordinates() ;
14+
15+
public static IEnumerable<(double, double)> MinAndMaxCoordinates => StaticValueProvider.Invalid.GetMinAndMaxCoordinates();
16+
17+
1318
[TestMethod]
1419
public void Constructor_Parameterless_Ok() {
1520
// Arrange && Act
@@ -72,6 +77,30 @@ public void Encode_BufferTooSmall_Throws_InternalBufferOverflowException() {
7277
Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
7378
}
7479

80+
[TestMethod]
81+
[DynamicData(nameof(NotANumberAndInfinityCoordinates))]
82+
public void Encode_NotANumberAndInfinityCoordinate_Throws_ArgumentOutOfRangeException((double, double) coordinate) {
83+
// Arrange
84+
85+
// Act
86+
var exception = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => _encoder.Encode([coordinate]));
87+
88+
// Assert
89+
Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
90+
}
91+
92+
[TestMethod]
93+
[DynamicData(nameof(MinAndMaxCoordinates))]
94+
public void Encode_MinAndMaxCoordinate_Throws_ArgumentOutOfRangeException((double, double) coordinate) {
95+
// Arrange
96+
97+
// Act
98+
var exception = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => _encoder.Encode([coordinate]));
99+
100+
// Assert
101+
Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
102+
}
103+
75104
[TestMethod]
76105
[DynamicData(nameof(CoordinateCount))]
77106
public void Encode_RandomValue_ValidInput_Ok(int count) {

0 commit comments

Comments
 (0)