-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
ToString.cs
50 lines (44 loc) · 1.54 KB
/
ToString.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.IO.Tests
{
public class FileInfo_ToString : FileSystemTest
{
[Fact]
public void ValidFile()
{
string path = GetTestFilePath();
var info = new FileInfo(path);
Assert.Equal(path, info.ToString());
}
[Fact]
public void RootDriveFiles()
{
string path = Path.Combine(Path.GetPathRoot(TestDirectory), GetTestFileName());
var info = new FileInfo(path);
Assert.Equal(path, info.ToString());
}
[Fact]
public void WithExtension()
{
string path = Path.Combine(GetTestFilePath(), "file.txt");
var info = new FileInfo(path);
Assert.Equal(path, info.ToString());
}
[Fact]
public void AlternateDirectoryDividerChar()
{
string path = Path.Combine(Path.GetPathRoot(Directory.GetCurrentDirectory()), "Directory", "File").Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
var info = new FileInfo(path);
Assert.Equal(path, info.ToString());
}
[Fact]
public void UNCShare()
{
string path = new string(Path.DirectorySeparatorChar, 2) + Path.Combine("Machine", "Directory", "File");
var info = new FileInfo(path);
Assert.Equal(path, info.ToString());
}
}
}