Skip to content

Commit 1b78839

Browse files
committed
posite test for decoder
1 parent 6d39166 commit 1b78839

1 file changed

Lines changed: 26 additions & 52 deletions

File tree

tests/PolylineAlgorithm.Abstraction.Tests/PolylineDecoderTest.cs

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -105,58 +105,32 @@ public void Decode_ShortPolyline_Throws_InvalidPolylineException() {
105105
Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
106106
}
107107

108-
//[TestMethod]
109-
//[DynamicData(nameof(NotANumberAndInfinityCoordinates))]
110-
//public void Decode_NotANumberAndInfinityCoordinate_Throws_ArgumentOutOfRangeException((double, double) coordinate) {
111-
// // Arrange
112-
// void Decode() => _decoder.Decode([coordinate])
113-
// // Act
114-
// var exception = Assert.ThrowsExactly<ArgumentOutOfRangeException>(Decode);
115-
116-
// // Assert
117-
// Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
118-
//}
119-
120-
//[TestMethod]
121-
//[DynamicData(nameof(MinAndMaxCoordinates))]
122-
//public void Decode_MinAndMaxCoordinate_Throws_ArgumentOutOfRangeException((double, double) coordinate) {
123-
// // Arrange
124-
125-
// // Act
126-
// var exception = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => _decoder.Decode([coordinate]));
127-
128-
// // Assert
129-
// Assert.IsFalse(string.IsNullOrWhiteSpace(exception.Message));
130-
//}
131-
132-
//[TestMethod]
133-
//[DynamicData(nameof(CoordinateCount))]
134-
//public void Decode_RandomValue_ValidInput_Ok(int count) {
135-
// // Arrange
136-
// IEnumerable<(double Latitude, double Longitude)> coordinates = RandomValueProvider.GetCoordinates(count);
137-
// string expected = RandomValueProvider.GetPolyline(count);
138-
139-
// // Act
140-
// var result = _decoder.Decode(coordinates);
141-
142-
// // Assert
143-
// Assert.AreEqual(expected.Length, result.Length);
144-
// Assert.IsTrue(expected.Equals(result));
145-
//}
146-
147-
//[TestMethod]
148-
//public void Decode_StaticValue_ValidInput_Ok() {
149-
// // Arrange
150-
// IEnumerable<(double Latitude, double Longitude)> coordinates = StaticValueProvider.Valid.GetCoordinates();
151-
// string expected = StaticValueProvider.Valid.GetPolyline();
152-
153-
// // Act
154-
// var result = _decoder.Decode(coordinates);
155-
156-
// // Assert
157-
// Assert.AreEqual(expected.Length, result.Length);
158-
// Assert.IsTrue(expected.Equals(result));
159-
//}
108+
[TestMethod]
109+
[DynamicData(nameof(CoordinateCount))]
110+
public void Encode_RandomValue_ValidInput_Ok(int count) {
111+
// Arrange
112+
string polyline = RandomValueProvider.GetPolyline(count);
113+
IEnumerable<(double Latitude, double Longitude)> expected = RandomValueProvider.GetCoordinates(count);
114+
115+
// Act
116+
var result = _decoder.Decode(polyline);
117+
118+
// Assert
119+
CollectionAssert.AreEqual(expected.ToArray(), result.ToArray());
120+
}
121+
122+
[TestMethod]
123+
public void Decode_StaticValue_ValidInput_Ok() {
124+
// Arrange
125+
string polyline = StaticValueProvider.Valid.GetPolyline();
126+
IEnumerable<(double Latitude, double Longitude)> expected = StaticValueProvider.Valid.GetCoordinates();
127+
128+
// Act
129+
var result = _decoder.Decode(polyline);
130+
131+
// Assert
132+
CollectionAssert.AreEqual(expected.ToArray(), result.ToArray());
133+
}
160134

161135
public class PolylineDecoder : PolylineDecoder<string, (double Latitude, double Longitude)> {
162136
public PolylineDecoder()

0 commit comments

Comments
 (0)