-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSharpAccessibilityKeywordTests.cs
More file actions
112 lines (85 loc) · 3.15 KB
/
CSharpAccessibilityKeywordTests.cs
File metadata and controls
112 lines (85 loc) · 3.15 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using EasySourceGenerators.Generators.SourceEmitting;
using Microsoft.CodeAnalysis;
namespace EasySourceGenerators.GeneratorTests;
[TestFixture]
public class CSharpAccessibilityKeywordTests
{
// -----------------------------------------------------------------------
// From (returns "private" as default)
// -----------------------------------------------------------------------
[Test]
public void From_Public_ReturnsPublic()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.Public);
Assert.That(result, Is.EqualTo("public"));
}
[Test]
public void From_Protected_ReturnsProtected()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.Protected);
Assert.That(result, Is.EqualTo("protected"));
}
[Test]
public void From_Internal_ReturnsInternal()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.Internal);
Assert.That(result, Is.EqualTo("internal"));
}
[Test]
public void From_ProtectedOrInternal_ReturnsProtectedInternal()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.ProtectedOrInternal);
Assert.That(result, Is.EqualTo("protected internal"));
}
[Test]
public void From_ProtectedAndInternal_ReturnsPrivateProtected()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.ProtectedAndInternal);
Assert.That(result, Is.EqualTo("private protected"));
}
[Test]
public void From_Private_ReturnsPrivate()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.Private);
Assert.That(result, Is.EqualTo("private"));
}
[Test]
public void From_NotApplicable_ReturnsPrivate()
{
string result = CSharpAccessibilityKeyword.From(Accessibility.NotApplicable);
Assert.That(result, Is.EqualTo("private"));
}
// -----------------------------------------------------------------------
// FromOrEmpty (returns "" as default)
// -----------------------------------------------------------------------
[Test]
public void FromOrEmpty_Public_ReturnsPublic()
{
string result = CSharpAccessibilityKeyword.FromOrEmpty(Accessibility.Public);
Assert.That(result, Is.EqualTo("public"));
}
[Test]
public void FromOrEmpty_Protected_ReturnsProtected()
{
string result = CSharpAccessibilityKeyword.FromOrEmpty(Accessibility.Protected);
Assert.That(result, Is.EqualTo("protected"));
}
[Test]
public void FromOrEmpty_Internal_ReturnsInternal()
{
string result = CSharpAccessibilityKeyword.FromOrEmpty(Accessibility.Internal);
Assert.That(result, Is.EqualTo("internal"));
}
[Test]
public void FromOrEmpty_Private_ReturnsEmptyString()
{
string result = CSharpAccessibilityKeyword.FromOrEmpty(Accessibility.Private);
Assert.That(result, Is.EqualTo(""));
}
[Test]
public void FromOrEmpty_NotApplicable_ReturnsEmptyString()
{
string result = CSharpAccessibilityKeyword.FromOrEmpty(Accessibility.NotApplicable);
Assert.That(result, Is.EqualTo(""));
}
}