-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStringCaseConverterTest.cs
181 lines (153 loc) · 6.67 KB
/
StringCaseConverterTest.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
using NUnit.Framework;
using Shouldly;
namespace CodingSeb.Converters.Tests
{
[TestFixture]
public class StringCaseConverterTest
{
[Category("Convert")]
[Test]
public void ConvertDefaultValueReturnStringAsThis()
{
StringCaseConverter converter = new StringCaseConverter();
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToNormalCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.Normal);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToNormalCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.Normal
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToLowerCaseCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.lowercase);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("hello this is a test");
}
[Category("Convert")]
[Test]
public void ConvertToLowerCaseCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.lowercase
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("hello this is a test");
}
[Category("Convert")]
[Test]
public void ConvertToUpperCaseCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.UPPERCASE);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HELLO THIS IS A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToUpperCaseCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.UPPERCASE
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HELLO THIS IS A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToSetFirstLetterUpperCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.Firstletterupper);
converter.Convert("helLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToSetFirstLetterUpperCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.Firstletterupper
};
converter.Convert("helLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToSetFirstLetterLowerCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.firstLetterLower);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("helLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToSetFirstLetterLowerCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.firstLetterLower
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("helLo This is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToFirstLetterOfEachWordUpperCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.FirstLetterOfEachWordUpper);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This Is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToFirstLetterOfEachWordUpperCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.FirstLetterOfEachWordUpper
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This Is A TEST");
}
[Category("Convert")]
[Test]
public void ConvertToFirstLetterOfEachWordLowerCasingModeSetByConstructor()
{
StringCaseConverter converter = new StringCaseConverter(StringCasingMode.firstletterofeachwordlower);
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("helLo this is a tEST");
}
[Category("Convert")]
[Test]
public void ConvertToFirstLetterOfEachWordLowerCasingModeSetByProperty()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.firstletterofeachwordlower
};
converter.Convert("HelLo This is A TEST", null, null, null).ShouldBe("helLo this is a tEST");
}
[Category("ConvertBack")]
[Test]
public void ConvertBackStringAsThis()
{
StringCaseConverter converter = new StringCaseConverter()
{
CasingMode = StringCasingMode.Normal
};
converter.ConvertBack("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
converter.CasingMode = StringCasingMode.lowercase;
converter.ConvertBack("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
converter.CasingMode = StringCasingMode.UPPERCASE;
converter.ConvertBack("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
converter.CasingMode = StringCasingMode.firstLetterLower;
converter.ConvertBack("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
converter.CasingMode = StringCasingMode.Firstletterupper;
converter.ConvertBack("HelLo This is A TEST", null, null, null).ShouldBe("HelLo This is A TEST");
}
}
}