1- using System ;
2- using System . Collections . Generic ;
31using Xunit ;
42
53namespace BinaryObjectScanner . Test
@@ -33,300 +31,5 @@ public void FileSize_Invalid_Invalid()
3331 }
3432
3533 #endregion
36-
37- #region IterateWithAction
38-
39- [ Fact ]
40- public void IterateWithAction_EmptyEnumerable_Success ( )
41- {
42- List < string > set = new List < string > ( ) ;
43- Action < string > action = ( s ) => s . ToLowerInvariant ( ) ;
44-
45- set . IterateWithAction ( action ) ;
46- Assert . Empty ( set ) ;
47- }
48-
49- [ Fact ]
50- public void IterateWithAction_EmptyAction_Success ( )
51- {
52- List < string > set = [ "a" , "b" , "c" ] ;
53- Action < string > action = ( s ) => { } ;
54-
55- set . IterateWithAction ( action ) ;
56- Assert . Equal ( 3 , set . Count ) ;
57- }
58-
59- [ Fact ]
60- public void IterateWithAction_Valid_Success ( )
61- {
62- List < string > set = [ "a" , "b" , "c" ] ;
63- List < string > actual = new List < string > ( ) ;
64-
65- Action < string > action = ( s ) =>
66- {
67- lock ( actual )
68- {
69- actual . Add ( s . ToUpperInvariant ( ) ) ;
70- }
71- } ;
72-
73- set . IterateWithAction ( action ) ;
74- Assert . Equal ( 3 , set . Count ) ;
75- Assert . Equal ( 3 , actual . Count ) ;
76- }
77-
78- #endregion
79-
80- #region OptionalContains
81-
82- [ Fact ]
83- public void OptionalContains_NullStringNoComparison_False ( )
84- {
85- string ? str = null ;
86- string prefix = "prefix" ;
87-
88- bool actual = str . OptionalContains ( prefix ) ;
89- Assert . False ( actual ) ;
90- }
91-
92- [ Fact ]
93- public void OptionalContains_NullStringComparison_False ( )
94- {
95- string ? str = null ;
96- string prefix = "prefix" ;
97-
98- bool actual = str . OptionalContains ( prefix , StringComparison . OrdinalIgnoreCase ) ;
99- Assert . False ( actual ) ;
100- }
101-
102- [ Fact ]
103- public void OptionalContains_EmptyStringNoComparison_False ( )
104- {
105- string ? str = string . Empty ;
106- string prefix = "prefix" ;
107-
108- bool actual = str . OptionalContains ( prefix ) ;
109- Assert . False ( actual ) ;
110- }
111-
112- [ Fact ]
113- public void OptionalContains_EmptyStringComparison_False ( )
114- {
115- string ? str = string . Empty ;
116- string prefix = "prefix" ;
117-
118- bool actual = str . OptionalContains ( prefix , StringComparison . OrdinalIgnoreCase ) ;
119- Assert . False ( actual ) ;
120- }
121-
122- [ Fact ]
123- public void OptionalContains_NoMatchNoComparison_False ( )
124- {
125- string ? str = "postfix" ;
126- string prefix = "prefix" ;
127-
128- bool actual = str . OptionalContains ( prefix ) ;
129- Assert . False ( actual ) ;
130- }
131-
132- [ Fact ]
133- public void OptionalContains_NoMatchComparison_False ( )
134- {
135- string ? str = "postfix" ;
136- string prefix = "prefix" ;
137-
138- bool actual = str . OptionalContains ( prefix , StringComparison . OrdinalIgnoreCase ) ;
139- Assert . False ( actual ) ;
140- }
141-
142- [ Fact ]
143- public void OptionalContains_MatchesNoComparison_True ( )
144- {
145- string ? str = "prefix" ;
146- string prefix = "prefix" ;
147-
148- bool actual = str . OptionalContains ( prefix ) ;
149- Assert . True ( actual ) ;
150- }
151-
152- [ Fact ]
153- public void OptionalContains_MatchesComparison_True ( )
154- {
155- string ? str = "prefix" ;
156- string prefix = "prefix" ;
157-
158- bool actual = str . OptionalContains ( prefix , StringComparison . OrdinalIgnoreCase ) ;
159- Assert . True ( actual ) ;
160- }
161-
162- #endregion
163-
164- #region OptionalEquals
165-
166- [ Fact ]
167- public void OptionalEquals_NullStringNoComparison_False ( )
168- {
169- string ? str = null ;
170- string prefix = "prefix" ;
171-
172- bool actual = str . OptionalEquals ( prefix ) ;
173- Assert . False ( actual ) ;
174- }
175-
176- [ Fact ]
177- public void OptionalEquals_NullStringComparison_False ( )
178- {
179- string ? str = null ;
180- string prefix = "prefix" ;
181-
182- bool actual = str . OptionalEquals ( prefix , StringComparison . OrdinalIgnoreCase ) ;
183- Assert . False ( actual ) ;
184- }
185-
186- [ Fact ]
187- public void OptionalEquals_EmptyStringNoComparison_False ( )
188- {
189- string ? str = string . Empty ;
190- string prefix = "prefix" ;
191-
192- bool actual = str . OptionalEquals ( prefix ) ;
193- Assert . False ( actual ) ;
194- }
195-
196- [ Fact ]
197- public void OptionalEquals_EmptyStringComparison_False ( )
198- {
199- string ? str = string . Empty ;
200- string prefix = "prefix" ;
201-
202- bool actual = str . OptionalEquals ( prefix , StringComparison . OrdinalIgnoreCase ) ;
203- Assert . False ( actual ) ;
204- }
205-
206- [ Fact ]
207- public void OptionalEquals_NoMatchNoComparison_False ( )
208- {
209- string ? str = "postfix" ;
210- string prefix = "prefix" ;
211-
212- bool actual = str . OptionalEquals ( prefix ) ;
213- Assert . False ( actual ) ;
214- }
215-
216- [ Fact ]
217- public void OptionalEquals_NoMatchComparison_False ( )
218- {
219- string ? str = "postfix" ;
220- string prefix = "prefix" ;
221-
222- bool actual = str . OptionalEquals ( prefix , StringComparison . OrdinalIgnoreCase ) ;
223- Assert . False ( actual ) ;
224- }
225-
226- [ Fact ]
227- public void OptionalEquals_MatchesNoComparison_True ( )
228- {
229- string ? str = "prefix" ;
230- string prefix = "prefix" ;
231-
232- bool actual = str . OptionalEquals ( prefix ) ;
233- Assert . True ( actual ) ;
234- }
235-
236- [ Fact ]
237- public void OptionalEquals_MatchesComparison_True ( )
238- {
239- string ? str = "prefix" ;
240- string prefix = "prefix" ;
241-
242- bool actual = str . OptionalEquals ( prefix , StringComparison . OrdinalIgnoreCase ) ;
243- Assert . True ( actual ) ;
244- }
245-
246- #endregion
247-
248- #region OptionalStartsWith
249-
250- [ Fact ]
251- public void OptionalStartsWith_NullStringNoComparison_False ( )
252- {
253- string ? str = null ;
254- string prefix = "prefix" ;
255-
256- bool actual = str . OptionalStartsWith ( prefix ) ;
257- Assert . False ( actual ) ;
258- }
259-
260- [ Fact ]
261- public void OptionalStartsWith_NullStringComparison_False ( )
262- {
263- string ? str = null ;
264- string prefix = "prefix" ;
265-
266- bool actual = str . OptionalStartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ;
267- Assert . False ( actual ) ;
268- }
269-
270- [ Fact ]
271- public void OptionalStartsWith_EmptyStringNoComparison_False ( )
272- {
273- string ? str = string . Empty ;
274- string prefix = "prefix" ;
275-
276- bool actual = str . OptionalStartsWith ( prefix ) ;
277- Assert . False ( actual ) ;
278- }
279-
280- [ Fact ]
281- public void OptionalStartsWith_EmptyStringComparison_False ( )
282- {
283- string ? str = string . Empty ;
284- string prefix = "prefix" ;
285-
286- bool actual = str . OptionalStartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ;
287- Assert . False ( actual ) ;
288- }
289-
290- [ Fact ]
291- public void OptionalStartsWith_NoMatchNoComparison_False ( )
292- {
293- string ? str = "postfix" ;
294- string prefix = "prefix" ;
295-
296- bool actual = str . OptionalStartsWith ( prefix ) ;
297- Assert . False ( actual ) ;
298- }
299-
300- [ Fact ]
301- public void OptionalStartsWith_NoMatchComparison_False ( )
302- {
303- string ? str = "postfix" ;
304- string prefix = "prefix" ;
305-
306- bool actual = str . OptionalStartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ;
307- Assert . False ( actual ) ;
308- }
309-
310- [ Fact ]
311- public void OptionalStartsWith_MatchesNoComparison_True ( )
312- {
313- string ? str = "prefix" ;
314- string prefix = "prefix" ;
315-
316- bool actual = str . OptionalStartsWith ( prefix ) ;
317- Assert . True ( actual ) ;
318- }
319-
320- [ Fact ]
321- public void OptionalStartsWith_MatchesComparison_True ( )
322- {
323- string ? str = "prefix" ;
324- string prefix = "prefix" ;
325-
326- bool actual = str . OptionalStartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) ;
327- Assert . True ( actual ) ;
328- }
329-
330- #endregion
33134 }
33235}
0 commit comments