-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
ExtensionsTests.cs
66 lines (55 loc) · 1.94 KB
/
ExtensionsTests.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
public class ExtensionsTests
{
[Test]
public void IsText()
{
#region IsText
True(FileExtensions.IsTextFile("file.txt"));
False(FileExtensions.IsTextFile("file.bin"));
True(FileExtensions.IsTextExtension(".txt"));
False(FileExtensions.IsTextExtension(".bin"));
True(FileExtensions.IsTextExtension("txt"));
False(FileExtensions.IsTextExtension("bin"));
#endregion
}
[Test]
public void IsTextLegacy()
{
#pragma warning disable CS0618 // Type or member is obsolete
True(FileExtensions.IsText("file.txt"));
False(FileExtensions.IsText("file.bin"));
True(FileExtensions.IsText("c:/file.txt"));
False(FileExtensions.IsText("c:/file.bin"));
True(FileExtensions.IsText(".txt"));
True(FileExtensions.IsText("txt"));
False(FileExtensions.IsText(".bin"));
False(FileExtensions.IsText("bin"));
#pragma warning restore CS0618 // Type or member is obsolete
}
[Test]
public void AddTextExtension()
{
#region AddTextExtension
FileExtensions.AddTextExtension(".ext1");
True(FileExtensions.IsTextExtension(".ext1"));
True(FileExtensions.IsTextFile("file.ext1"));
#endregion
FileExtensions.AddTextExtension("ext2");
True(FileExtensions.IsTextExtension("ext2"));
True(FileExtensions.IsTextFile("file.ext2"));
}
[Test]
public void RemoveTextExtension()
{
#region RemoveTextExtension
FileExtensions.AddTextExtension(".ext1");
True(FileExtensions.IsTextExtension(".ext1"));
FileExtensions.RemoveTextExtension(".ext1");
False(FileExtensions.IsTextExtension(".ext1"));
#endregion
FileExtensions.AddTextExtension("ext1");
True(FileExtensions.IsTextExtension("ext1"));
FileExtensions.RemoveTextExtension("ext1");
False(FileExtensions.IsTextExtension("ext1"));
}
}