1- using NUnit . Framework ;
1+ using NUnit . Framework ;
22using System ;
33
44namespace CodeArtEng . Controls . UnitTests
@@ -22,13 +22,13 @@ public void Setup()
2222 [ Test ]
2323 public void GetArgumentsName ( )
2424 {
25- Assert . AreEqual ( new string [ ] { "Source" } , cmdLine . GetArgumentsName ( ) ) ;
25+ Assert . That ( cmdLine . GetArgumentsName ( ) , Is . EqualTo ( new string [ ] { "Source" } ) ) ;
2626 }
2727
2828 [ Test ]
2929 public void GetSwitchesName ( )
3030 {
31- Assert . AreEqual ( new string [ ] { "/AD" , "/MIN" , "/DELAY" } , cmdLine . GetSwitchesName ( ) ) ;
31+ Assert . That ( cmdLine . GetSwitchesName ( ) , Is . EqualTo ( new string [ ] { "/AD" , "/MIN" , "/DELAY" } ) ) ;
3232 }
3333
3434
@@ -37,15 +37,15 @@ public void SetDescription_Constructor()
3737 {
3838 string desc = DateTime . Now . ToString ( ) ;
3939 CommandLineHelper cmdLine2 = new CommandLineHelper ( desc ) ;
40- Assert . AreEqual ( desc , cmdLine2 . Description ) ;
40+ Assert . That ( cmdLine2 . Description , Is . EqualTo ( desc ) ) ;
4141 }
4242
4343 [ Test ]
4444 public void SetDescription_Property ( )
4545 {
4646 string desc = DateTime . Now . ToString ( ) ;
4747 cmdLine . Description = desc ;
48- Assert . AreEqual ( desc , cmdLine . Description ) ;
48+ Assert . That ( cmdLine . Description , Is . EqualTo ( desc ) ) ;
4949 }
5050
5151 [ Test ]
@@ -75,148 +75,148 @@ public void AddSwitches_Duplicate_Exception()
7575 [ Test ]
7676 public void IsSwitchSet_InvalidSwitch ( )
7777 {
78- Assert . AreEqual ( false , cmdLine . IsSwitchSet ( "/NotExist" ) ) ;
78+ Assert . That ( cmdLine . IsSwitchSet ( "/NotExist" ) , Is . EqualTo ( false ) ) ;
7979 }
8080
8181 [ Test ]
8282 public void GetArgumentValue_Invalid ( )
8383 {
8484 Assert . Throws < ArgumentNullException > ( ( ) =>
85- {
86- cmdLine . GetArgumentValue ( "Unknown" ) ;
87- } ) ;
85+ {
86+ cmdLine . GetArgumentValue ( "Unknown" ) ;
87+ } ) ;
8888 }
8989
9090 [ Test ]
9191 public void SetArgument ( )
9292 {
9393 cmdLine . SetArgument ( "Source" , "C:\\ Temp" ) ;
94- Assert . AreEqual ( "C: \\ Temp" , cmdLine . GetArgumentValue ( "Source ") ) ;
94+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "C: \\ Temp ") ) ;
9595 }
9696
9797 [ Test ]
9898 public void SetSwitch ( )
9999 {
100100 cmdLine . SetSwitch ( "/MIN" ) ;
101- Assert . IsTrue ( cmdLine . IsSwitchSet ( "/MIN" ) ) ;
101+ Assert . That ( cmdLine . IsSwitchSet ( "/MIN" ) , Is . True ) ;
102102 }
103103
104104 [ Test ]
105105 public void SetSwitchValue ( )
106106 {
107107 cmdLine . SetSwitch ( "/DELAY" , "200" ) ;
108- Assert . IsTrue ( cmdLine . IsSwitchSet ( "/DeLaY" ) ) ;
109- Assert . AreEqual ( "200" , cmdLine . GetSwitchValue ( "/Delay" ) ) ;
108+ Assert . That ( cmdLine . IsSwitchSet ( "/DeLaY" ) , Is . True ) ;
109+ Assert . That ( cmdLine . GetSwitchValue ( "/Delay" ) , Is . EqualTo ( "200 ") ) ;
110110 }
111111
112112 [ Test ]
113113 public void SetArgument_InvalidArgument ( )
114114 {
115115 Assert . Throws < ArgumentException > ( ( ) =>
116- {
117- cmdLine . SetArgument ( "DUMMY" , "TEST" ) ;
118- } ) ;
116+ {
117+ cmdLine . SetArgument ( "DUMMY" , "TEST" ) ;
118+ } ) ;
119119 }
120120
121121 [ Test ]
122122 public void SetSwitch_InvalidSwitch ( )
123123 {
124124 Assert . Throws < ArgumentException > ( ( ) =>
125- {
126- cmdLine . SetSwitch ( "/NOTEXIST" ) ;
127- } ) ;
125+ {
126+ cmdLine . SetSwitch ( "/NOTEXIST" ) ;
127+ } ) ;
128128 }
129129
130130
131131 [ Test ]
132132 public void ParseCommandLine ( )
133133 {
134134 bool status = cmdLine . ParseCommandLine ( ( "SourcePath /AD" ) . Split ( ' ' ) ) ;
135- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
136- Assert . IsTrue ( cmdLine . IsSwitchSet ( "/AD" ) ) ;
137- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/min" ) ) ;
138- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/Delay" ) ) ;
139- Assert . AreEqual ( "NoDelay" , cmdLine . GetSwitchValue ( "/delay" , "NoDelay" ) ) ;
140- Assert . IsTrue ( status ) ;
135+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
136+ Assert . That ( cmdLine . IsSwitchSet ( "/AD" ) , Is . True ) ;
137+ Assert . That ( cmdLine . IsSwitchSet ( "/min" ) , Is . False ) ;
138+ Assert . That ( cmdLine . IsSwitchSet ( "/Delay" ) , Is . False ) ;
139+ Assert . That ( cmdLine . GetSwitchValue ( "/delay" , "NoDelay" ) , Is . EqualTo ( "NoDelay" ) ) ;
140+ Assert . That ( status , Is . True ) ;
141141 }
142142
143143 [ Test ]
144144 public void ParseCommandLine_SwitchNotSet ( )
145145 {
146146 cmdLine . ParseCommandLine ( ( "SourcePath" ) . Split ( ' ' ) ) ;
147- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
148- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/AD" ) ) ;
149- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/MIN" ) ) ;
147+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
148+ Assert . That ( cmdLine . IsSwitchSet ( "/AD" ) , Is . False ) ;
149+ Assert . That ( cmdLine . IsSwitchSet ( "/MIN" ) , Is . False ) ;
150150 }
151151
152152 [ Test ]
153153 public void ParseCommandLine_SetInvalidSwitch ( )
154154 {
155155 cmdLine . ParseCommandLine ( ( "SourcePath /ADS" ) . Split ( ' ' ) ) ;
156- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
157- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/AD" ) ) ;
158- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/MIN" ) ) ;
156+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
157+ Assert . That ( cmdLine . IsSwitchSet ( "/AD" ) , Is . False ) ;
158+ Assert . That ( cmdLine . IsSwitchSet ( "/MIN" ) , Is . False ) ;
159159 }
160160
161161 [ Test ]
162162 public void ParseCommandLine_MissingMandatoryArg_Exception ( )
163163 {
164164 Assert . Throws < Exception > ( ( ) =>
165- {
166- cmdLine . ParseCommandLine ( ( "/AD /MIN" ) . Split ( ' ' ) ) ;
167- } ) ;
165+ {
166+ cmdLine . ParseCommandLine ( ( "/AD /MIN" ) . Split ( ' ' ) ) ;
167+ } ) ;
168168 }
169169
170170 [ Test ]
171171 public void ParseCommandLine_SetSwitchWithValue ( )
172172 {
173173 cmdLine . ParseCommandLine ( ( "SourcePath /delay:100" ) . Split ( ' ' ) ) ;
174- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
175- Assert . AreEqual ( "100" , cmdLine . GetSwitchValue ( "/Delay" , "-1" ) ) ;
174+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
175+ Assert . That ( cmdLine . GetSwitchValue ( "/Delay" , "-1" ) , Is . EqualTo ( "100 ") ) ;
176176 }
177177
178178 [ Test ]
179179 public void ParseCommandLine_SetSwitchWithoutValue ( )
180180 {
181181 cmdLine . ParseCommandLine ( ( "SourcePath /delay" ) . Split ( ' ' ) ) ;
182- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
183- Assert . AreEqual ( "-1" , cmdLine . GetSwitchValue ( "/Delay" , "-1" ) ) ;
182+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
183+ Assert . That ( cmdLine . GetSwitchValue ( "/Delay" , "-1" ) , Is . EqualTo ( "-1" ) ) ;
184184 }
185185
186186 [ Test ]
187187 public void ParseCommandLine_SetValueToBooleanSwitch ( )
188188 {
189189 cmdLine . ParseCommandLine ( ( "SourcePath /min:100" ) . Split ( ' ' ) ) ;
190- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
191- Assert . AreEqual ( "NotValid" , cmdLine . GetSwitchValue ( "/min" , "NotValid" ) ) ;
190+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
191+ Assert . That ( cmdLine . GetSwitchValue ( "/min" , "NotValid" ) , Is . EqualTo ( "NotValid" ) ) ;
192192 }
193193
194194 [ Test ]
195195 public void ParseCommandLine_NoMandatoryArgument ( )
196196 {
197197 cmdLine = new CommandLineHelper ( "Testing" ) ;
198- Assert . IsTrue ( cmdLine . ParseCommandLine ( ( "/A /BC" ) . Split ( ' ' ) ) ) ;
198+ Assert . That ( cmdLine . ParseCommandLine ( ( "/A /BC" ) . Split ( ' ' ) ) , Is . True ) ;
199199 }
200200
201201 [ Test ]
202202 public void ParseCommandLine_TooMuchArguments ( )
203203 {
204204 cmdLine . ParseCommandLine ( ( "SourcePath DestPath /X /delay:5555 /XY /TEST" ) . Split ( ' ' ) ) ;
205- Assert . AreEqual ( "SourcePath" , cmdLine . GetArgumentValue ( "Source ") ) ;
206- Assert . AreEqual ( "5555" , cmdLine . GetSwitchValue ( "/Delay" , "-1" ) ) ;
205+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "SourcePath ") ) ;
206+ Assert . That ( cmdLine . GetSwitchValue ( "/Delay" , "-1" ) , Is . EqualTo ( "5555 ") ) ;
207207 }
208208
209209 [ Test ]
210210 public void ParseCommandLine_EmptyCommand ( )
211211 {
212- Assert . IsFalse ( cmdLine . ParseCommandLine ( new string [ ] { } ) ) ;
212+ Assert . That ( cmdLine . ParseCommandLine ( new string [ ] { } ) , Is . False ) ;
213213 }
214214
215215 [ Test ]
216216 public void ParseCommandLine_EnvArgs ( )
217217 {
218218 //NUnit Command Line is not empty by default
219- Assert . IsTrue ( cmdLine . ParseCommandLine ( ) ) ;
219+ Assert . That ( cmdLine . ParseCommandLine ( ) , Is . True ) ;
220220 }
221221
222222 [ Test ]
@@ -225,13 +225,13 @@ public void Reset()
225225 cmdLine . SetArgument ( "Source" , "Test Value" ) ;
226226 cmdLine . SetSwitch ( "/MIN" ) ;
227227
228- Assert . AreEqual ( "Test Value" , cmdLine . GetArgumentValue ( "Source ") ) ;
229- Assert . IsTrue ( cmdLine . IsSwitchSet ( "/MIN" ) ) ;
228+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . EqualTo ( "Test Value ") ) ;
229+ Assert . That ( cmdLine . IsSwitchSet ( "/MIN" ) , Is . True ) ;
230230
231231 cmdLine . Reset ( ) ;
232232
233- Assert . IsEmpty ( cmdLine . GetArgumentValue ( "Source" ) ) ;
234- Assert . IsFalse ( cmdLine . IsSwitchSet ( "/MIN" ) ) ;
233+ Assert . That ( cmdLine . GetArgumentValue ( "Source" ) , Is . Empty ) ;
234+ Assert . That ( cmdLine . IsSwitchSet ( "/MIN" ) , Is . False ) ;
235235 }
236236
237237 [ Test ]
@@ -241,7 +241,7 @@ public void SetSwitchValueWithColumn()
241241 cmd . AddSwitch ( "/log" , "Log File." , "logFile" ) ;
242242 cmd . SetSwitch ( "/log" , "C:\\ Temp\\ Output.txt" ) ;
243243
244- Assert . AreEqual ( " C:\\ Temp\\ Output.txt" , cmd . GetSwitchValue ( "/log ") ) ;
244+ Assert . That ( cmd . GetSwitchValue ( "/log" ) , Is . EqualTo ( " C:\\ Temp\\ Output.txt") ) ;
245245 }
246246
247247 [ Test ]
@@ -250,7 +250,7 @@ public void ParseCommandLineFileName()
250250 CommandLineHelper cmd = new CommandLineHelper ( "File" ) ;
251251 cmd . AddSwitch ( "/log" , "Log File." , "logFile" ) ;
252252 cmd . ParseCommandLine ( ( "/log:C:\\ Temp\\ Output.txt" ) . Split ( ' ' ) ) ;
253- Assert . AreEqual ( " C:\\ Temp\\ Output.txt" , cmd . GetSwitchValue ( "/log ") ) ;
253+ Assert . That ( cmd . GetSwitchValue ( "/log" ) , Is . EqualTo ( " C:\\ Temp\\ Output.txt") ) ;
254254 }
255255
256256 }
0 commit comments