@@ -45,6 +45,25 @@ public void Combine_2Paths_Rooted_ShouldReturnLastRootedPath(
45
45
result . Should ( ) . Be ( path2 ) ;
46
46
}
47
47
48
+ [ SkippableTheory ]
49
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/bar/" ) ]
50
+ [ InlineAutoData ( "foo/" , "/bar" , "/bar" ) ]
51
+ [ InlineAutoData ( "foo/" , "bar" , "foo/bar" ) ]
52
+ [ InlineAutoData ( "foo" , "/bar" , "/bar" ) ]
53
+ [ InlineAutoData ( "foo" , "bar" , "foo/bar" ) ]
54
+ [ InlineAutoData ( "/foo" , "bar/" , "/foo/bar/" ) ]
55
+ public void Combine_2Paths_ShouldReturnExpectedResult (
56
+ string path1 , string path2 , string expectedResult )
57
+ {
58
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
59
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
60
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
61
+
62
+ string result = FileSystem . Path . Combine ( path1 , path2 ) ;
63
+
64
+ result . Should ( ) . Be ( expectedResult ) ;
65
+ }
66
+
48
67
[ SkippableTheory ]
49
68
[ InlineAutoData ]
50
69
[ InlineAutoData ( " " ) ]
@@ -109,6 +128,27 @@ public void Combine_3Paths_Rooted_ShouldReturnLastRootedPath(
109
128
result . Should ( ) . Be ( path3 ) ;
110
129
}
111
130
131
+ [ SkippableTheory ]
132
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/baz/" ) ]
133
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz" , "/baz" ) ]
134
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "/baz" ) ]
135
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "/baz" ) ]
136
+ [ InlineAutoData ( "foo" , "/bar/" , "baz" , "/bar/baz" ) ]
137
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "foo/bar/baz" ) ]
138
+ [ InlineAutoData ( "/foo" , "bar" , "baz/" , "/foo/bar/baz/" ) ]
139
+ public void Combine_3Paths_ShouldReturnExpectedResult (
140
+ string path1 , string path2 , string path3 , string expectedResult )
141
+ {
142
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
143
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
144
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
145
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
146
+
147
+ string result = FileSystem . Path . Combine ( path1 , path2 , path3 ) ;
148
+
149
+ result . Should ( ) . Be ( expectedResult ) ;
150
+ }
151
+
112
152
[ SkippableTheory ]
113
153
[ InlineAutoData ]
114
154
[ InlineAutoData ( " " ) ]
@@ -183,6 +223,28 @@ public void Combine_4Paths_Rooted_ShouldReturnLastRootedPath(
183
223
result . Should ( ) . Be ( path4 ) ;
184
224
}
185
225
226
+ [ SkippableTheory ]
227
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/muh/" , "/muh/" ) ]
228
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz/" , "/muh" , "/muh" ) ]
229
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "/muh" , "/muh" ) ]
230
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "/muh" , "/muh" ) ]
231
+ [ InlineAutoData ( "foo" , "/bar/" , "baz/" , "muh" , "/bar/baz/muh" ) ]
232
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "muh" , "foo/bar/baz/muh" ) ]
233
+ [ InlineAutoData ( "/foo" , "bar" , "baz" , "muh/" , "/foo/bar/baz/muh/" ) ]
234
+ public void Combine_4Paths_ShouldReturnExpectedResult (
235
+ string path1 , string path2 , string path3 , string path4 , string expectedResult )
236
+ {
237
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
238
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
239
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
240
+ path4 = path4 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
241
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
242
+
243
+ string result = FileSystem . Path . Combine ( path1 , path2 , path3 , path4 ) ;
244
+
245
+ result . Should ( ) . Be ( expectedResult ) ;
246
+ }
247
+
186
248
[ SkippableTheory ]
187
249
[ InlineAutoData ]
188
250
[ InlineAutoData ( " " ) ]
@@ -281,6 +343,29 @@ public void Combine_ParamPaths_Rooted_ShouldReturnLastRootedPath(
281
343
result . Should ( ) . Be ( path5 ) ;
282
344
}
283
345
346
+ [ SkippableTheory ]
347
+ [ InlineAutoData ( "/foo/" , "/bar/" , "/baz/" , "/muh/" , "/maeh/" , "/maeh/" ) ]
348
+ [ InlineAutoData ( "foo/" , "/bar/" , "/baz/" , "/muh" , "/maeh" , "/maeh" ) ]
349
+ [ InlineAutoData ( "foo/" , "bar" , "/baz" , "/muh" , "/maeh" , "/maeh" ) ]
350
+ [ InlineAutoData ( "foo" , "/bar" , "/baz" , "/muh" , "/maeh" , "/maeh" ) ]
351
+ [ InlineAutoData ( "foo" , "/bar/" , "baz/" , "muh/" , "maeh" , "/bar/baz/muh/maeh" ) ]
352
+ [ InlineAutoData ( "foo" , "bar" , "baz" , "muh" , "maeh" , "foo/bar/baz/muh/maeh" ) ]
353
+ [ InlineAutoData ( "/foo" , "bar" , "baz" , "muh" , "maeh/" , "/foo/bar/baz/muh/maeh/" ) ]
354
+ public void Combine_ParamPaths_ShouldReturnExpectedResult (
355
+ string path1 , string path2 , string path3 , string path4 , string path5 , string expectedResult )
356
+ {
357
+ path1 = path1 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
358
+ path2 = path2 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
359
+ path3 = path3 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
360
+ path4 = path4 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
361
+ path5 = path5 . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
362
+ expectedResult = expectedResult . Replace ( '/' , FileSystem . Path . DirectorySeparatorChar ) ;
363
+
364
+ string result = FileSystem . Path . Combine ( path1 , path2 , path3 , path4 , path5 ) ;
365
+
366
+ result . Should ( ) . Be ( expectedResult ) ;
367
+ }
368
+
284
369
[ SkippableTheory ]
285
370
[ InlineAutoData ]
286
371
[ InlineAutoData ( " " ) ]
0 commit comments