@@ -40,6 +40,43 @@ public void Constructor_Parameterless_Ok() {
4040 Assert . IsTrue ( polyline . Value . IsEmpty ) ;
4141 }
4242
43+ /// <summary>
44+ /// Tests the <see cref="Polyline"/> constructor with a null character array, expecting an <see cref="ArgumentNullException"/>.
45+ /// </summary>
46+ [ TestMethod ]
47+ public void FromString_Null_String_ArgumentNullException ( ) {
48+ // Arrange
49+ string value = null ! ;
50+ static Polyline New ( char [ ] value ) => Polyline . FromString ( value ) ;
51+
52+ // Act
53+ var exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => New ( value ) ) ;
54+
55+ // Assert
56+
57+ }
58+
59+ /// <summary>
60+ /// Tests the <see cref="Polyline"/> constructor with a character array parameter.
61+ /// </summary>
62+ /// <param name="value">The string value.</param>
63+ [ TestMethod ]
64+ [ DynamicData ( nameof ( LengthParameters ) ) ]
65+ public void FromString_String_Parameter_Ok ( int size ) {
66+ // Arrange
67+ var polyline = RandomValueProvider . GetPolyline ( size ) ;
68+ bool isEmpty = polyline . Length == 0 ;
69+ long length = polyline . Length ;
70+
71+ // Act
72+ Polyline result = Polyline . FromString ( polyline ) ;
73+
74+ // Assert
75+ Assert . AreEqual ( isEmpty , result . IsEmpty ) ;
76+ Assert . AreEqual ( length , result . Length ) ;
77+ Assert . AreEqual ( new string ( polyline ) , result . ToString ( ) ) ;
78+ }
79+
4380 /// <summary>
4481 /// Tests the <see cref="Polyline"/> constructor with a null character array, expecting an <see cref="ArgumentNullException"/>.
4582 /// </summary>
@@ -77,6 +114,27 @@ public void FromCharArray_CharArray_Parameter_Ok(int size) {
77114 Assert . AreEqual ( new string ( polyline ) , result . ToString ( ) ) ;
78115 }
79116
117+ /// <summary>
118+ /// Tests the <see cref="Polyline"/> constructor with a memory parameter.
119+ /// </summary>
120+ /// <param name="value">The string value.</param>
121+ [ TestMethod ]
122+ [ DynamicData ( nameof ( LengthParameters ) ) ]
123+ public void FromMemory_Empty_Memory_Parameter_Ok ( int size ) {
124+ // Arrange
125+ var polyline = ReadOnlyMemory < char > . Empty ;
126+ bool isEmpty = polyline . Length == 0 ;
127+ long length = polyline . Length ;
128+
129+ // Act
130+ Polyline result = Polyline . FromMemory ( polyline ) ;
131+
132+ // Assert
133+ Assert . AreEqual ( isEmpty , result . IsEmpty ) ;
134+ Assert . AreEqual ( length , result . Length ) ;
135+ Assert . AreEqual ( polyline . ToString ( ) , result . ToString ( ) ) ;
136+ }
137+
80138 /// <summary>
81139 /// Tests the <see cref="Polyline"/> constructor with a memory parameter.
82140 /// </summary>
0 commit comments