@@ -5,6 +5,49 @@ public abstract partial class GetFullPathTests<TFileSystem>
5
5
: FileSystemTestBase < TFileSystem >
6
6
where TFileSystem : IFileSystem
7
7
{
8
+ [ SkippableFact ]
9
+ public void GetFullPath_Dot_ShouldReturnToCurrentDirectory ( )
10
+ {
11
+ string expectedFullPath = FileSystem . Directory . GetCurrentDirectory ( ) ;
12
+
13
+ string result = FileSystem . Path . GetFullPath ( "." ) ;
14
+
15
+ result . Should ( ) . Be ( expectedFullPath ) ;
16
+ }
17
+
18
+ [ SkippableFact ]
19
+ public void GetFullPath_RelativePathWithDrive_ShouldReturnExpectedValue ( )
20
+ {
21
+ Skip . IfNot ( Test . RunsOnWindows ) ;
22
+
23
+ string currentDirectory = FileSystem . Directory . GetCurrentDirectory ( ) ;
24
+ string drive = currentDirectory . Substring ( 0 , 1 ) ;
25
+ string input = $ "{ drive } :test.txt";
26
+ string expectedFullPath = FileSystem . Path . Combine ( currentDirectory , "test.txt" ) ;
27
+
28
+ string result = FileSystem . Path . GetFullPath ( input ) ;
29
+
30
+ result . Should ( ) . Be ( expectedFullPath ) ;
31
+ }
32
+
33
+ [ SkippableFact ]
34
+ public void
35
+ GetFullPath_RelativePathWithDrive_WhenCurrentDirectoryIsDifferent_ShouldReturnExpectedValue ( )
36
+ {
37
+ Skip . IfNot ( Test . RunsOnWindows ) ;
38
+
39
+ string currentDirectory = FileSystem . Directory . GetCurrentDirectory ( ) ;
40
+ string otherDrive = currentDirectory
41
+ . Substring ( 0 , 1 )
42
+ . Equals ( "x" , StringComparison . OrdinalIgnoreCase ) ? "Y" : "X" ;
43
+ string input = $ "{ otherDrive } :test.txt";
44
+ string expectedFullPath = $@ "{ otherDrive } :\test.txt";
45
+
46
+ string result = FileSystem . Path . GetFullPath ( input ) ;
47
+
48
+ result . Should ( ) . Be ( expectedFullPath ) ;
49
+ }
50
+
8
51
[ SkippableTheory ]
9
52
[ InlineData ( @"top/../most/file" , @"most/file" ) ]
10
53
[ InlineData ( @"top/../most/../dir/file" , @"dir/file" ) ]
0 commit comments