@@ -104,9 +104,14 @@ public void TestSetInfoNull(string endpointId)
104104 int infoAfterLibNameIndex = infoAfter . IndexOf ( "lib-name=" ) ;
105105 int infoBeforeLibNameIndex = infoBefore . IndexOf ( "lib-name=" ) ;
106106
107+ int infoAfterLibVerIndex = infoAfter . IndexOf ( " " , infoAfter ! . IndexOf ( "lib-ver=" ) ) ;
108+ infoAfterLibVerIndex = infoAfterLibVerIndex == - 1 ? infoAfter . Length : infoAfterLibVerIndex ;
109+ int infoBeforeLibVerIndex = infoBefore ! . IndexOf ( " " , infoBefore ! . IndexOf ( "lib-ver=" ) ) ;
110+ infoBeforeLibVerIndex = infoBeforeLibVerIndex == - 1 ? infoBefore . Length : infoBeforeLibVerIndex ;
111+
107112 // Extract the sub-strings starting from "lib-name="
108- string infoAfterLibNameToEnd = infoAfter . Substring ( infoAfterLibNameIndex ) ;
109- string infoBeforeLibNameToEnd = infoBefore . Substring ( infoBeforeLibNameIndex ) ;
113+ string infoAfterLibNameToEnd = infoAfter . Substring ( infoAfterLibNameIndex , infoAfterLibVerIndex - infoAfterLibNameIndex ) ;
114+ string infoBeforeLibNameToEnd = infoBefore . Substring ( infoBeforeLibNameIndex , infoBeforeLibVerIndex - infoBeforeLibNameIndex ) ;
110115
111116 // Assert that the extracted sub-strings are equal
112117 Assert . Equal ( infoAfterLibNameToEnd , infoBeforeLibNameToEnd ) ;
@@ -127,9 +132,14 @@ public async Task TestSetInfoNullAsync(string endpointId)
127132 int infoAfterLibNameIndex = infoAfter . IndexOf ( "lib-name=" ) ;
128133 int infoBeforeLibNameIndex = infoBefore . IndexOf ( "lib-name=" ) ;
129134
135+ int infoAfterLibVerIndex = infoAfter . IndexOf ( " " , infoAfter ! . IndexOf ( "lib-ver=" ) ) ;
136+ infoAfterLibVerIndex = infoAfterLibVerIndex == - 1 ? infoAfter . Length : infoAfterLibVerIndex ;
137+ int infoBeforeLibVerIndex = infoBefore . IndexOf ( " " , infoBefore ! . IndexOf ( "lib-ver=" ) ) ;
138+ infoBeforeLibVerIndex = infoBeforeLibVerIndex == - 1 ? infoBefore . Length : infoBeforeLibVerIndex ;
139+
130140 // Extract the sub-strings starting from "lib-name="
131- string infoAfterLibNameToEnd = infoAfter . Substring ( infoAfterLibNameIndex ) ;
132- string infoBeforeLibNameToEnd = infoBefore . Substring ( infoBeforeLibNameIndex ) ;
141+ string infoAfterLibNameToEnd = infoAfter . Substring ( infoAfterLibNameIndex , infoAfterLibVerIndex - infoAfterLibNameIndex ) ;
142+ string infoBeforeLibNameToEnd = infoBefore . Substring ( infoBeforeLibNameIndex , infoBeforeLibVerIndex - infoBeforeLibNameIndex ) ;
133143
134144 // Assert that the extracted sub-strings are equal
135145 Assert . Equal ( infoAfterLibNameToEnd , infoBeforeLibNameToEnd ) ;
0 commit comments