-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
Name.cs
37 lines (32 loc) · 1.11 KB
/
Name.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
// 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 DirectoryInfo_Name : FileSystemTest
{
[Fact]
public void Ctor_NullArgument_Throws()
{
AssertExtensions.Throws<ArgumentNullException>("path", () => new DirectoryInfo(null));
}
[Fact]
public void CurrentDirectory()
{
var info = new DirectoryInfo(".");
Assert.Equal(Path.GetFileName(Directory.GetCurrentDirectory()), info.Name);
}
[Fact]
public void UNCShareName()
{
var info = new DirectoryInfo(new string(Path.DirectorySeparatorChar, 2) + Path.Combine("contoso", "amusement", "device"));
Assert.Equal("device", info.Name);
}
[Fact]
public void RootName()
{
var info = new DirectoryInfo(Path.GetPathRoot(Directory.GetCurrentDirectory()));
Assert.Equal(Path.GetPathRoot(Directory.GetCurrentDirectory()), info.Name);
}
}
}