@@ -29,20 +29,20 @@ private void TestParser(Type type, CompiledTable expected)
2929 ]
3030 class Asset
3131 {
32- public string id { get ; set ; }
32+ public string id { get ; set ; } = "" ;
3333
3434 public DateTime created_at { get ; set ; }
3535
36- public string make { get ; set ; }
36+ public string make { get ; set ; } = "" ;
3737
38- public string model { get ; set ; }
38+ public string model { get ; set ; } = "" ;
3939
4040 public int quantity { get ; set ; }
4141
4242 public string ? description { get ; set ; }
4343
4444 [ Ignored ]
45- public string non_table_field { get ; set ; }
45+ public string non_table_field { get ; set ; } = "" ;
4646 }
4747
4848 [ Fact ]
@@ -87,20 +87,20 @@ public void AttributeParser_Assets_Test()
8787 ]
8888 class Product
8989 {
90- public string id { get ; set ; }
90+ public string id { get ; set ; } = "" ;
9191
9292 [ Column ( ColumnType = ColumnType . Real ) ]
9393 public DateTime created_at { get ; set ; }
9494
95- public string description { get ; set ; }
95+ public string description { get ; set ; } = "" ;
9696
9797 [ Column ( TrackPrevious = true ) ]
9898 public int quantity { get ; set ; }
9999
100100 [ Column ( TrackPrevious = true ) ]
101101 public decimal ppu { get ; set ; }
102102
103- public string seller_id { get ; set ; }
103+ public string seller_id { get ; set ; } = "" ;
104104 }
105105
106106 [ Fact ]
@@ -158,10 +158,10 @@ enum LogLevel
158158 class Log
159159 {
160160 [ Column ( "id" ) ]
161- public string LogId { get ; set ; }
161+ public string LogId { get ; set ; } = "" ;
162162
163163 [ Column ( "description" ) ]
164- public string Description { get ; set ; }
164+ public string Description { get ; set ; } = "" ;
165165
166166 [ Column ( "timestamp" ) ]
167167 public DateTimeOffset Timestamp { get ; set ; }
@@ -199,13 +199,14 @@ public void AttributeParser_Logs_Test()
199199 TestParser ( typeof ( Log ) , expected ) ;
200200 }
201201
202- class Invalid1 { public string id { get ; set ; } }
202+ class Invalid1 { public string id { get ; set ; } = "" ; }
203203 [ Fact ]
204204 public async void AttributeParser_InvalidSchema_1 ( )
205205 {
206- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
206+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
207207 {
208208 new AttributeParser ( typeof ( Invalid1 ) ) . ParseTable ( ) ;
209+ return Task . CompletedTask ;
209210 } ) ;
210211 Assert . Contains ( "must be marked with TableAttribute" , ex . Message ) ;
211212 }
@@ -215,9 +216,10 @@ class Invalid2 { }
215216 [ Fact ]
216217 public async void AttributeParser_InvalidSchema_2 ( )
217218 {
218- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
219+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
219220 {
220221 new AttributeParser ( typeof ( Invalid2 ) ) . ParseTable ( ) ;
222+ return Task . CompletedTask ;
221223 } ) ;
222224 Assert . Contains ( "'id' property is required" , ex . Message ) ;
223225 }
@@ -227,9 +229,10 @@ class Invalid3 { public int id { get; set; } }
227229 [ Fact ]
228230 public async void AttributeParser_InvalidSchema_3 ( )
229231 {
230- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
232+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
231233 {
232234 new AttributeParser ( typeof ( Invalid3 ) ) . ParseTable ( ) ;
235+ return Task . CompletedTask ;
233236 } ) ;
234237 Assert . Contains ( "must be of type string" , ex . Message ) ;
235238 }
@@ -238,66 +241,70 @@ public async void AttributeParser_InvalidSchema_3()
238241 class Invalid4
239242 {
240243 [ Column ( ColumnType = ColumnType . Real ) ]
241- public string id { get ; set ; }
244+ public string id { get ; set ; } = "" ;
242245 }
243246 [ Fact ]
244247 public async void AttributeParser_InvalidSchema_4 ( )
245248 {
246- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
249+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
247250 {
248251 new AttributeParser ( typeof ( Invalid4 ) ) . ParseTable ( ) ;
252+ return Task . CompletedTask ;
249253 } ) ;
250254 Assert . Contains ( "must have ColumnType set to ColumnType.Text or ColumnType.Inferred" , ex . Message ) ;
251255 }
252256
253257 [ Table ( "invalid" ) ]
254258 class Invalid5
255259 {
256- public string id { get ; set ; }
257- public Invalid1 invalid_type { get ; set ; }
260+ public string id { get ; set ; } = "" ;
261+ public Invalid1 invalid_type { get ; set ; } = default ! ;
258262 }
259263 [ Fact ]
260264 public async void AttributeParser_InvalidSchema_5 ( )
261265 {
262- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
266+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
263267 {
264268 new AttributeParser ( typeof ( Invalid5 ) ) . ParseTable ( ) ;
269+ return Task . CompletedTask ;
265270 } ) ;
266271 Assert . Contains ( "Unable to automatically infer ColumnType" , ex . Message ) ;
267272 }
268273
269274 [ Table ( "invalid" , TrackPreviousValues = TrackPrevious . Columns | TrackPrevious . Table ) ]
270275 class Invalid6
271276 {
272- public string id { get ; set ; }
277+ public string id { get ; set ; } = "" ;
273278 }
274279 [ Fact ]
275280 public async void AttributeParser_InvalidSchema_6 ( )
276281 {
277- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
282+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
278283 {
279284 new AttributeParser ( typeof ( Invalid6 ) ) . ParseTable ( ) ;
285+ return Task . CompletedTask ;
280286 } ) ;
281287 Assert . Contains ( "Cannot specify both TrackPrevious.Columns and TrackPrevious.Table" , ex . Message ) ;
282288 }
283289
284290 [ Table ( "invalid" , TrackPreviousValues = TrackPrevious . OnlyWhenChanged ) ]
285291 class Invalid7
286292 {
287- public string id { get ; set ; }
293+ public string id { get ; set ; } = "" ;
288294 }
289295 [ Fact ]
290296 public async void AttributeParser_InvalidSchema_7 ( )
291297 {
292- var ex = await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) =>
298+ var ex = await Assert . ThrowsAsync < InvalidOperationException > ( ( ) =>
293299 {
294300 new AttributeParser ( typeof ( Invalid7 ) ) . ParseTable ( ) ;
301+ return Task . CompletedTask ;
295302 } ) ;
296303 Assert . Contains ( "Cannot specify TrackPrevious.OnlyWhenChanged without also specifying" , ex . Message ) ;
297304 }
298305
299306 [ Fact ]
300- public async void AttributeParser_TypeMap_CustomRegistered ( )
307+ public void AttributeParser_TypeMap_CustomRegistered ( )
301308 {
302309 // Log has Column aliases
303310 new AttributeParser ( typeof ( Log ) ) . RegisterDapperTypeMap ( ) ;
@@ -306,7 +313,7 @@ public async void AttributeParser_TypeMap_CustomRegistered()
306313 }
307314
308315 [ Fact ]
309- public async void AttributeParser_TypeMap_DefaultRegistered ( )
316+ public void AttributeParser_TypeMap_DefaultRegistered ( )
310317 {
311318 // Asset has no Column aliases
312319 new AttributeParser ( typeof ( Asset ) ) . RegisterDapperTypeMap ( ) ;
0 commit comments