shokai / ConsoleLib.NET
params(args) parser for .NETFrameowrk3.5 and Mono2.0
$ hg clone http://bitbucket.org/shokai/consolelibnet/
| commit 14: | 2fbdc9d527e5 |
| parent 13: | d127eb789a4b |
| branch: | default |
13 months ago
Changed (Δ1.5 KB):
Console.sln (2 lines added, 1 lines removed)
Console.suo (binary file changed)
ConsoleLibSample/bin/Debug/ConsoleLibSample.exe (binary file changed)
ConsoleLibTest/ParamsParserTest.cs (17 lines added, 0 lines removed)
ConsoleLibTest/bin/Debug/ConsoleLibTest.dll (binary file changed)
| … | … | @@ -12,12 +12,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956 |
12 |
12 |
Console.vsmdi = Console.vsmdi |
13 |
13 |
Console1.vsmdi = Console1.vsmdi |
14 |
14 |
Console2.vsmdi = Console2.vsmdi |
15 |
Console3.vsmdi = Console3.vsmdi |
|
15 |
16 |
LocalTestRun.testrunconfig = LocalTestRun.testrunconfig |
16 |
17 |
EndProjectSection |
17 |
18 |
EndProject |
18 |
19 |
Global |
19 |
20 |
GlobalSection(TestCaseManagementSettings) = postSolution |
20 |
CategoryFile = Console |
|
21 |
CategoryFile = Console3.vsmdi |
|
21 |
22 |
EndGlobalSection |
22 |
23 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
23 |
24 |
Debug|Any CPU = Debug|Any CPU |
Up to file-list ConsoleLibSample/bin/Debug/ConsoleLibSample.exe:
Up to file-list ConsoleLibTest/ParamsParserTest.cs:
| … | … | @@ -135,6 +135,15 @@ namespace ConsoleLibTest |
135 |
135 |
ParamsParser target = new ParamsParser(args); // TODO: 適切な値に初期化してください |
136 |
136 |
Assert.AreEqual(0, target.Switches.Count, "スイッチが無い時は要素数0で返してください"); |
137 |
137 |
} |
138 |
||
139 |
[TestMethod()] |
|
140 |
public void SwitchesTest5() |
|
141 |
{ |
|
142 |
string[] args = new string[]{"-m-essage", "--o-ut"}; // TODO: 適切な値に初期化してください |
|
143 |
ParamsParser target = new ParamsParser(args); // TODO: 適切な値に初期化してください |
|
144 |
Assert.IsTrue(target.Switches.Count == 2 && |
|
145 |
target.hasSwitch("m-essage") && target.hasSwitch("o-ut"), "スイッチ名の2文字目以降に-を含む事ができるようにしてください"); |
|
146 |
} |
|
138 |
147 |
#endregion |
139 |
148 |
|
140 |
149 |
|
| … | … | @@ -163,6 +172,14 @@ namespace ConsoleLibTest |
163 |
172 |
ParamsParser target = new ParamsParser(args); |
164 |
173 |
Assert.AreEqual(0, target.Params.Count, "パラメータが無い時は要素数0で返してください"); |
165 |
174 |
} |
175 |
||
176 |
[TestMethod()] |
|
177 |
public void ParamsTest4() |
|
178 |
{ |
|
179 |
string[] args = new string[] { "-p-o-st", "te-st" }; |
|
180 |
ParamsParser target = new ParamsParser(args); |
|
181 |
Assert.IsTrue(target.Params.Count == 1 && target.Params["p-o-st"] == "te-st", "パラメータ名の2文字目以降に-が含む事ができるようにしてください"); |
|
182 |
} |
|
166 |
183 |
|
167 |
184 |
#endregion |
168 |
185 |
Up to file-list ConsoleLibTest/bin/Debug/ConsoleLibTest.dll:
