@@ -19,6 +19,25 @@ public void Join_2Paths_OneNullOrEmpty_ShouldReturnCombinationOfOtherParts(
19
19
result2 . Should ( ) . Be ( path ) ;
20
20
}
21
21
22
+ [ SkippableTheory ]
23
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/foo//bar/" ) ]
24
+ [ InlineAutoData ( "foo/" , "/bar" , "foo//bar" ) ]
25
+ [ InlineAutoData ( "foo/" , "bar" , "foo/bar" ) ]
26
+ [ InlineAutoData ( "foo" , "/bar" , "foo/bar" ) ]
27
+ [ InlineAutoData ( "foo" , "bar" , "foo/bar" ) ]
28
+ [ InlineAutoData ( "/foo" , "bar/" , "/foo/bar/" ) ]
29
+ public void Join_2Paths_ShouldReturnExpectedResult (
30
+ string path1 , string path2 , string expectedResult )
31
+ {
32
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
33
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
34
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
35
+
36
+ string result = FileSystem . Path . Join ( path1 , path2 ) ;
37
+
38
+ result . Should ( ) . Be ( expectedResult ) ;
39
+ }
40
+
22
41
[ SkippableTheory ]
23
42
[ AutoData ]
24
43
public void Join_2Paths_ShouldReturnPathsCombinedByDirectorySeparatorChar (
@@ -64,6 +83,27 @@ public void Join_3Paths_OneNullOrEmpty_ShouldReturnCombinationOfOtherParts(
64
83
result3 . Should ( ) . Be ( expectedPath ) ;
65
84
}
66
85
86
+ [ SkippableTheory ]
87
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/foo//bar//baz/" ) ]
88
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz" , "foo//bar//baz" ) ]
89
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "foo/bar/baz" ) ]
90
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "foo/bar/baz" ) ]
91
+ [ InlineAutoData ( "foo" , "/bar/" , "baz" , "foo/bar/baz" ) ]
92
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "foo/bar/baz" ) ]
93
+ [ InlineAutoData ( "/foo" , "bar" , "baz/" , "/foo/bar/baz/" ) ]
94
+ public void Join_3Paths_ShouldReturnExpectedResult (
95
+ string path1 , string path2 , string path3 , string expectedResult )
96
+ {
97
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
98
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
99
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
100
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
101
+
102
+ string result = FileSystem . Path . Join ( path1 , path2 , path3 ) ;
103
+
104
+ result . Should ( ) . Be ( expectedResult ) ;
105
+ }
106
+
67
107
[ SkippableTheory ]
68
108
[ AutoData ]
69
109
public void Join_3Paths_ShouldReturnPathsCombinedByDirectorySeparatorChar (
@@ -115,6 +155,28 @@ public void Join_4Paths_OneNullOrEmpty_ShouldReturnCombinationOfOtherParts(
115
155
result4 . Should ( ) . Be ( expectedPath ) ;
116
156
}
117
157
158
+ [ SkippableTheory ]
159
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/muh/" , "/foo//bar//baz//muh/" ) ]
160
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz/" , "/muh" , "foo//bar//baz//muh" ) ]
161
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "/muh" , "foo/bar/baz/muh" ) ]
162
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "/muh" , "foo/bar/baz/muh" ) ]
163
+ [ InlineAutoData ( "foo" , "/bar/" , "baz/" , "muh" , "foo/bar/baz/muh" ) ]
164
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "muh" , "foo/bar/baz/muh" ) ]
165
+ [ InlineAutoData ( "/foo" , "bar" , "baz" , "muh/" , "/foo/bar/baz/muh/" ) ]
166
+ public void Join_4Paths_ShouldReturnExpectedResult (
167
+ string path1 , string path2 , string path3 , string path4 , string expectedResult )
168
+ {
169
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
170
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
171
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
172
+ path4 = path4 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
173
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
174
+
175
+ string result = FileSystem . Path . Join ( path1 , path2 , path3 , path4 ) ;
176
+
177
+ result . Should ( ) . Be ( expectedResult ) ;
178
+ }
179
+
118
180
[ SkippableTheory ]
119
181
[ AutoData ]
120
182
public void Join_4Paths_ShouldReturnPathsCombinedByDirectorySeparatorChar (
@@ -149,6 +211,27 @@ public void Join_4Paths_Span_ShouldReturnPathsCombinedByDirectorySeparatorChar(
149
211
result . Should ( ) . Be ( expectedResult ) ;
150
212
}
151
213
214
+ [ SkippableFact ]
215
+ public void Join_ParamPaths_Empty_ShouldReturnEmptyString ( )
216
+ {
217
+ string ? [ ] paths = Array . Empty < string ? > ( ) ;
218
+
219
+ string result = FileSystem . Path . Join ( paths ) ;
220
+
221
+ result . Should ( ) . Be ( string . Empty ) ;
222
+ }
223
+
224
+ [ SkippableFact ]
225
+ public void Join_ParamPaths_Null_ShouldThrow ( )
226
+ {
227
+ Exception ? exception = Record . Exception ( ( ) =>
228
+ {
229
+ _ = FileSystem . Path . Join ( null ! ) ;
230
+ } ) ;
231
+
232
+ exception . Should ( ) . BeException < ArgumentNullException > ( paramName : "paths" ) ;
233
+ }
234
+
152
235
[ SkippableTheory ]
153
236
[ InlineAutoData ( ( string ? ) null ) ]
154
237
[ InlineAutoData ( "" ) ]
@@ -176,6 +259,29 @@ public void Join_ParamPaths_OneNullOrEmpty_ShouldReturnCombinationOfOtherParts(
176
259
result5 . Should ( ) . Be ( expectedPath ) ;
177
260
}
178
261
262
+ [ SkippableTheory ]
263
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/muh/" , "/maeh/" , "/foo//bar//baz//muh//maeh/" ) ]
264
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz/" , "/muh" , "/maeh" , "foo//bar//baz//muh/maeh" ) ]
265
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "/muh" , "/maeh" , "foo/bar/baz/muh/maeh" ) ]
266
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "/muh" , "/maeh" , "foo/bar/baz/muh/maeh" ) ]
267
+ [ InlineAutoData ( "foo" , "/bar/" , "baz/" , "muh/" , "maeh" , "foo/bar/baz/muh/maeh" ) ]
268
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "muh" , "maeh" , "foo/bar/baz/muh/maeh" ) ]
269
+ [ InlineAutoData ( "/foo" , "bar" , "baz" , "muh" , "maeh/" , "/foo/bar/baz/muh/maeh/" ) ]
270
+ public void Join_ParamPaths_ShouldReturnExpectedResult (
271
+ string path1 , string path2 , string path3 , string path4 , string path5 , string expectedResult )
272
+ {
273
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
274
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
275
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
276
+ path4 = path4 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
277
+ path5 = path5 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
278
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
279
+
280
+ string result = FileSystem . Path . Join ( path1 , path2 , path3 , path4 , path5 ) ;
281
+
282
+ result . Should ( ) . Be ( expectedResult ) ;
283
+ }
284
+
179
285
[ SkippableTheory ]
180
286
[ AutoData ]
181
287
public void Join_ParamPaths_ShouldReturnPathsCombinedByDirectorySeparatorChar (
0 commit comments