11using System . ComponentModel . DataAnnotations ;
2- using Shouldly ;
32
43namespace FormCraft . UnitTests . Extensions ;
54
@@ -85,7 +84,7 @@ public void AddFieldsFromAttributes_Should_Create_TextField_From_Annotations()
8584 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "FirstName" ) ;
8685
8786 firstNameField . ShouldNotBeNull ( ) ;
88- firstNameField ! . TypedConfiguration . Label . ShouldBe ( "First Name" ) ;
87+ firstNameField . TypedConfiguration . Label . ShouldBe ( "First Name" ) ;
8988 firstNameField . TypedConfiguration . Placeholder . ShouldBe ( "Enter first name" ) ;
9089 firstNameField . TypedConfiguration . IsRequired . ShouldBeTrue ( ) ;
9190 firstNameField . TypedConfiguration . InputType . ShouldBe ( "text" ) ;
@@ -104,7 +103,7 @@ public void AddFieldsFromAttributes_Should_Create_EmailField_From_Annotations()
104103 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "Email" ) ;
105104
106105 emailField . ShouldNotBeNull ( ) ;
107- emailField ! . TypedConfiguration . Label . ShouldBe ( "Email Address" ) ;
106+ emailField . TypedConfiguration . Label . ShouldBe ( "Email Address" ) ;
108107 emailField . TypedConfiguration . Placeholder . ShouldBe ( "[email protected] " ) ; 109108 emailField . TypedConfiguration . InputType . ShouldBe ( "email" ) ;
110109 emailField . TypedConfiguration . IsRequired . ShouldBeTrue ( ) ;
@@ -127,7 +126,7 @@ public void AddFieldsFromAttributes_Should_Create_NumberField_From_Annotations()
127126 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "Age" ) ;
128127
129128 ageField . ShouldNotBeNull ( ) ;
130- ageField ! . TypedConfiguration . Label . ShouldBe ( "Age" ) ;
129+ ageField . TypedConfiguration . Label . ShouldBe ( "Age" ) ;
131130 ageField . TypedConfiguration . Placeholder . ShouldBe ( "Enter your age" ) ;
132131 ageField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
133132 ageField . TypedConfiguration . AdditionalAttributes . ShouldContainKey ( "min" ) ;
@@ -148,7 +147,7 @@ public void AddFieldsFromAttributes_Should_Create_DateField_From_Annotations()
148147 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "BirthDate" ) ;
149148
150149 birthDateField . ShouldNotBeNull ( ) ;
151- birthDateField ! . TypedConfiguration . Label . ShouldBe ( "Birth Date" ) ;
150+ birthDateField . TypedConfiguration . Label . ShouldBe ( "Birth Date" ) ;
152151 birthDateField . TypedConfiguration . InputType . ShouldBe ( "date" ) ;
153152 }
154153
@@ -164,7 +163,7 @@ public void AddFieldsFromAttributes_Should_Create_CheckboxField_From_Annotations
164163 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "AgreeToTerms" ) ;
165164
166165 checkboxField . ShouldNotBeNull ( ) ;
167- checkboxField ! . TypedConfiguration . Label . ShouldBe ( "I agree to terms" ) ;
166+ checkboxField . TypedConfiguration . Label . ShouldBe ( "I agree to terms" ) ;
168167 checkboxField . TypedConfiguration . AdditionalAttributes . ShouldContainKey ( "text" ) ;
169168 checkboxField . TypedConfiguration . AdditionalAttributes [ "text" ] . ShouldBe ( "I agree to the terms and conditions" ) ;
170169 }
@@ -181,7 +180,7 @@ public void AddFieldsFromAttributes_Should_Create_TextAreaField_From_Annotations
181180 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "Comments" ) ;
182181
183182 textAreaField . ShouldNotBeNull ( ) ;
184- textAreaField ! . TypedConfiguration . Label . ShouldBe ( "Comments" ) ;
183+ textAreaField . TypedConfiguration . Label . ShouldBe ( "Comments" ) ;
185184 textAreaField . TypedConfiguration . Placeholder . ShouldBe ( "Enter your comments" ) ;
186185 textAreaField . TypedConfiguration . AdditionalAttributes . ShouldContainKey ( "rows" ) ;
187186 textAreaField . TypedConfiguration . AdditionalAttributes [ "rows" ] . ShouldBe ( 4 ) ;
@@ -198,7 +197,7 @@ public void AddFieldsFromAttributes_Should_Create_SelectField_From_Annotations()
198197 . FirstOrDefault ( f => f . FieldName == "Country" ) ;
199198
200199 selectField . ShouldNotBeNull ( ) ;
201- selectField ! . Label . ShouldBe ( "Country" ) ;
200+ selectField . Label . ShouldBe ( "Country" ) ;
202201 selectField . Placeholder . ShouldBe ( "Select your country" ) ;
203202 }
204203
@@ -214,7 +213,7 @@ public void EmailField_Should_Use_Default_Placeholder_When_Not_Specified()
214213 . FirstOrDefault ( ) ;
215214
216215 emailField . ShouldNotBeNull ( ) ;
217- emailField ! . TypedConfiguration . Placeholder . ShouldBe ( "[email protected] " ) ; 216+ emailField . TypedConfiguration . Placeholder . ShouldBe ( "[email protected] " ) ; 218217 }
219218
220219 [ Fact ]
@@ -230,31 +229,31 @@ public void NumberField_Should_Support_Multiple_Numeric_Types()
230229 . OfType < FieldConfigurationWrapper < NumberTestModel , int > > ( )
231230 . FirstOrDefault ( ) ;
232231 intField . ShouldNotBeNull ( ) ;
233- intField ! . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
232+ intField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
234233
235234 var decimalField = config . Fields
236235 . OfType < FieldConfigurationWrapper < NumberTestModel , decimal > > ( )
237236 . FirstOrDefault ( ) ;
238237 decimalField . ShouldNotBeNull ( ) ;
239- decimalField ! . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
238+ decimalField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
240239
241240 var doubleField = config . Fields
242241 . OfType < FieldConfigurationWrapper < NumberTestModel , double > > ( )
243242 . FirstOrDefault ( ) ;
244243 doubleField . ShouldNotBeNull ( ) ;
245- doubleField ! . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
244+ doubleField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
246245
247246 var floatField = config . Fields
248247 . OfType < FieldConfigurationWrapper < NumberTestModel , float > > ( )
249248 . FirstOrDefault ( ) ;
250249 floatField . ShouldNotBeNull ( ) ;
251- floatField ! . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
250+ floatField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
252251
253252 var longField = config . Fields
254253 . OfType < FieldConfigurationWrapper < NumberTestModel , long > > ( )
255254 . FirstOrDefault ( ) ;
256255 longField . ShouldNotBeNull ( ) ;
257- longField ! . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
256+ longField . TypedConfiguration . InputType . ShouldBe ( "number" ) ;
258257 }
259258
260259 [ Fact ]
@@ -269,7 +268,7 @@ public void DateField_Should_Support_Nullable_DateTime()
269268 . FirstOrDefault ( f => f . TypedConfiguration . FieldName == "AppointmentDate" ) ;
270269
271270 nullableDateField . ShouldNotBeNull ( ) ;
272- nullableDateField ! . TypedConfiguration . Label . ShouldBe ( "Appointment Date" ) ;
271+ nullableDateField . TypedConfiguration . Label . ShouldBe ( "Appointment Date" ) ;
273272 nullableDateField . TypedConfiguration . InputType . ShouldBe ( "date" ) ;
274273 }
275274
@@ -286,12 +285,12 @@ public void SelectField_Should_Store_Options_When_Provided()
286285 statusField . ShouldNotBeNull ( ) ;
287286
288287 // Check if options are stored in additional attributes
289- var additionalAttrs = statusField ! . AdditionalAttributes ;
288+ var additionalAttrs = statusField . AdditionalAttributes ;
290289 additionalAttrs . ShouldContainKey ( "options" ) ;
291290
292291 var options = additionalAttrs [ "options" ] as string [ ] ;
293292 options . ShouldNotBeNull ( ) ;
294- options ! . Length . ShouldBe ( 3 ) ;
293+ options . Length . ShouldBe ( 3 ) ;
295294 options . ShouldContain ( "Draft" ) ;
296295 options . ShouldContain ( "Published" ) ;
297296 options . ShouldContain ( "Archived" ) ;
@@ -311,7 +310,7 @@ public void TextArea_With_MaxLength_Should_Apply_Validation()
311310 textAreaField . ShouldNotBeNull ( ) ;
312311
313312 // Should have max length validator
314- textAreaField ! . TypedConfiguration . Validators
313+ textAreaField . TypedConfiguration . Validators
315314 . OfType < CustomValidator < TestModel , string > > ( )
316315 . ShouldNotBeEmpty ( ) ;
317316 }
0 commit comments