Skip to content

Commit d454a7e

Browse files
committed
added test to xtensions
1 parent 3ee415b commit d454a7e

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/PolylineAlgorithm.Tests/PolylineDecoderExtensionsTest.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,45 @@ public class PolylineDecoderExtensionsTest {
1111

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

14+
[TestMethod]
15+
public void Decode_Null_Decoder_Null_String_Throws_ArgumentNullException() {
16+
// Arrange
17+
void Decode() => PolylineDecoderExtensions.Decode(null!, string.Empty).ToList();
18+
19+
// Act
20+
var exception = Assert.ThrowsExactly<ArgumentNullException>(Decode);
21+
22+
// Assert
23+
Assert.AreEqual("decoder", exception.ParamName);
24+
Assert.IsTrue(exception.Message.Contains("Value cannot be null.", StringComparison.Ordinal));
25+
}
26+
27+
[TestMethod]
28+
public void Decode_Null_Decoder_Null_CharArray_Throws_ArgumentNullException() {
29+
// Arrange
30+
void Decode() => PolylineDecoderExtensions.Decode(null!, []).ToList();
31+
32+
// Act
33+
var exception = Assert.ThrowsExactly<ArgumentNullException>(Decode);
34+
35+
// Assert
36+
Assert.AreEqual("decoder", exception.ParamName);
37+
Assert.IsTrue(exception.Message.Contains("Value cannot be null.", StringComparison.Ordinal));
38+
}
39+
40+
[TestMethod]
41+
public void Decode_Null_Decoder_Empty_Memory_Throws_ArgumentNullException() {
42+
// Arrange
43+
void Decode() => PolylineDecoderExtensions.Decode(null!, Memory<char>.Empty).ToList();
44+
45+
// Act
46+
var exception = Assert.ThrowsExactly<ArgumentNullException>(Decode);
47+
48+
// Assert
49+
Assert.AreEqual("decoder", exception.ParamName);
50+
Assert.IsTrue(exception.Message.Contains("Value cannot be null.", StringComparison.Ordinal));
51+
}
52+
1453
[TestMethod]
1554
[DynamicData(nameof(CoordinateCount), DynamicDataSourceType.Property)]
1655
public void Decode_String_Returns_Expected_Coordinates(int count) {

0 commit comments

Comments
 (0)