@@ -143,13 +143,13 @@ public static IEnumerable<string[]> GetFullPath_RelativePaths_Cases
143143 {
144144 get
145145 {
146- yield return new [ ] { XFS . Path ( @"c:\a" ) , "b" , XFS . Path ( @"c:\a\b" ) } ;
147- yield return new [ ] { XFS . Path ( @"c:\a\b" ) , "c" , XFS . Path ( @"c:\a\b\c" ) } ;
148- yield return new [ ] { XFS . Path ( @"c:\a\b" ) , XFS . Path ( @"c\" ) , XFS . Path ( @"c:\a\b\c\" ) } ;
149- yield return new [ ] { XFS . Path ( @"c:\a\b" ) , XFS . Path ( @"..\c" ) , XFS . Path ( @"c:\a\c" ) } ;
150- yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\c\..\" ) , XFS . Path ( @"c:\a\b\" ) } ;
151- yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\..\..\..\..\d" ) , XFS . Path ( @"c:\d" ) } ;
152- yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\..\..\..\..\d\" ) , XFS . Path ( @"c:\d\" ) } ;
146+ yield return new [ ] { XFS . Path ( @"c:\a" ) , "b" , XFS . Path ( @"c:\a\b" ) } ;
147+ yield return new [ ] { XFS . Path ( @"c:\a\b" ) , "c" , XFS . Path ( @"c:\a\b\c" ) } ;
148+ yield return new [ ] { XFS . Path ( @"c:\a\b" ) , XFS . Path ( @"c\" ) , XFS . Path ( @"c:\a\b\c\" ) } ;
149+ yield return new [ ] { XFS . Path ( @"c:\a\b" ) , XFS . Path ( @"..\c" ) , XFS . Path ( @"c:\a\c" ) } ;
150+ yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\c\..\" ) , XFS . Path ( @"c:\a\b\" ) } ;
151+ yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\..\..\..\..\d" ) , XFS . Path ( @"c:\d" ) } ;
152+ yield return new [ ] { XFS . Path ( @"c:\a\b\c" ) , XFS . Path ( @"..\..\..\..\..\d\" ) , XFS . Path ( @"c:\d\" ) } ;
153153 }
154154 }
155155
@@ -172,11 +172,11 @@ public static IEnumerable<string[]> GetFullPath_RootedPathWithRelativeSegments_C
172172 {
173173 get
174174 {
175- yield return new [ ] { XFS . Path ( @"c:\a\b\..\c" ) , XFS . Path ( @"c:\a\c" ) } ;
176- yield return new [ ] { XFS . Path ( @"c:\a\b\.\.\..\.\c" ) , XFS . Path ( @"c:\a\c" ) } ;
177- yield return new [ ] { XFS . Path ( @"c:\a\b\.\c" ) , XFS . Path ( @"c:\a\b\c" ) } ;
178- yield return new [ ] { XFS . Path ( @"c:\a\b\.\.\.\.\c" ) , XFS . Path ( @"c:\a\b\c" ) } ;
179- yield return new [ ] { XFS . Path ( @"c:\a\..\..\c" ) , XFS . Path ( @"c:\c" ) } ;
175+ yield return new [ ] { XFS . Path ( @"c:\a\b\..\c" ) , XFS . Path ( @"c:\a\c" ) } ;
176+ yield return new [ ] { XFS . Path ( @"c:\a\b\.\.\..\.\c" ) , XFS . Path ( @"c:\a\c" ) } ;
177+ yield return new [ ] { XFS . Path ( @"c:\a\b\.\c" ) , XFS . Path ( @"c:\a\b\c" ) } ;
178+ yield return new [ ] { XFS . Path ( @"c:\a\b\.\.\.\.\c" ) , XFS . Path ( @"c:\a\b\c" ) } ;
179+ yield return new [ ] { XFS . Path ( @"c:\a\..\..\c" ) , XFS . Path ( @"c:\c" ) } ;
180180 }
181181 }
182182
@@ -198,14 +198,14 @@ public static IEnumerable<string[]> GetFullPath_AbsolutePaths_Cases
198198 {
199199 get
200200 {
201- yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"/b" ) , XFS . Path ( @"c:\b" ) } ;
202- yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"/b\" ) , XFS . Path ( @"c:\b\" ) } ;
203- yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"\b" ) , XFS . Path ( @"c:\b" ) } ;
204- yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"\b\..\c" ) , XFS . Path ( @"c:\c" ) } ;
205- yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\b\..\c" ) , XFS . Path ( @"z:\c" ) } ;
206- yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c" ) , XFS . Path ( @"\\computer\share\c" ) } ;
207- yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c\..\d" ) , XFS . Path ( @"\\computer\share\d" ) } ;
208- yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c\..\..\d" ) , XFS . Path ( @"\\computer\share\d" ) } ;
201+ yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"/b" ) , XFS . Path ( @"c:\b" ) } ;
202+ yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"/b\" ) , XFS . Path ( @"c:\b\" ) } ;
203+ yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"\b" ) , XFS . Path ( @"c:\b" ) } ;
204+ yield return new [ ] { XFS . Path ( @"c:\a" ) , XFS . Path ( @"\b\..\c" ) , XFS . Path ( @"c:\c" ) } ;
205+ yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\b\..\c" ) , XFS . Path ( @"z:\c" ) } ;
206+ yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c" ) , XFS . Path ( @"\\computer\share\c" ) } ;
207+ yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c\..\d" ) , XFS . Path ( @"\\computer\share\d" ) } ;
208+ yield return new [ ] { XFS . Path ( @"z:\a" ) , XFS . Path ( @"\\computer\share\c\..\..\d" ) , XFS . Path ( @"\\computer\share\d" ) } ;
209209 }
210210 }
211211
@@ -274,7 +274,7 @@ public void GetFullPath_WithMultipleDirectorySeparators_ShouldReturnTheNormalize
274274 var mockPath = new MockPath ( mockFileSystem ) ;
275275
276276 //Act
277- var actualFullPath = mockPath . GetFullPath ( XFS . Path ( @"c:\foo\\//bar\file.dat" ) ) ;
277+ var actualFullPath = mockPath . GetFullPath ( XFS . Path ( @"c:\foo\\//bar\file.dat" ) ) ;
278278
279279 //Assert
280280 Assert . AreEqual ( XFS . Path ( @"c:\foo\bar\file.dat" ) , actualFullPath ) ;
@@ -397,5 +397,61 @@ public void IsPathRooted_PathSentIn_DeterminesPathExists()
397397 //Assert
398398 Assert . AreEqual ( true , result ) ;
399399 }
400+
401+ #if FEATURE_ADVANCED_PATH_OPERATIONS
402+ [ Test ]
403+ public void IsPathFullyQualified_WithAbsolutePath_ReturnsTrue ( )
404+ {
405+ //Arrange
406+ var mockPath = new MockPath ( new MockFileSystem ( ) ) ;
407+
408+ //Act
409+ var result = mockPath . IsPathFullyQualified ( XFS . Path ( "C:\\ directory\\ file.txt" ) ) ;
410+
411+ //Assert
412+ Assert . IsTrue ( result ) ;
413+ }
414+
415+ [ Test ]
416+ public void IsPathFullyQualified_WithRelativePath_ReturnsFalse ( )
417+ {
418+ //Arrange
419+ var mockPath = new MockPath ( new MockFileSystem ( ) ) ;
420+
421+ //Act
422+ var result = mockPath . IsPathRooted ( XFS . Path ( "directory\\ file.txt" ) ) ;
423+
424+ //Assert
425+ Assert . IsFalse ( result ) ;
426+ }
427+
428+ [ Test ]
429+ public void IsPathFullyQualified_WithRelativePathParts_ReturnsFalse ( )
430+ {
431+ //Arrange
432+ var mockPath = new MockPath ( new MockFileSystem ( ) ) ;
433+
434+ //Act
435+ var result = mockPath . IsPathRooted ( XFS . Path ( "directory\\ ..\\ file.txt" ) ) ;
436+
437+ //Assert
438+ Assert . IsFalse ( result ) ;
439+ }
440+
441+
442+
443+ [ Test ]
444+ public void GetRelativePath_Works ( )
445+ {
446+ //Arrange
447+ var mockPath = new MockPath ( new MockFileSystem ( ) ) ;
448+
449+ //Act
450+ var result = mockPath . GetRelativePath ( XFS . Path ( "c:\\ d" ) , XFS . Path ( "c:\\ d\\ e\\ f.txt" ) ) ;
451+
452+ //Assert
453+ Assert . AreEqual ( XFS . Path ( "e\\ f.txt" ) , result ) ;
454+ }
455+ #endif
400456 }
401457}
0 commit comments