3
3
using NUnit . Framework ;
4
4
using Serilog ;
5
5
using Serilog . Events ;
6
+ using Shouldly ;
6
7
7
8
namespace Destructurama . Attributed . Tests ;
8
9
@@ -162,17 +163,17 @@ public void NotLoggedIfNull_Uninitialized()
162
163
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
163
164
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
164
165
165
- Assert . IsTrue ( props . ContainsKey ( "Integer" ) ) ;
166
- Assert . IsTrue ( props . ContainsKey ( "DateTime" ) ) ;
167
- Assert . IsTrue ( props . ContainsKey ( "Struct" ) ) ;
168
- Assert . IsTrue ( props . ContainsKey ( "StructPartiallyInitialized" ) ) ;
169
-
170
- Assert . IsFalse ( props . ContainsKey ( "String" ) ) ;
171
- Assert . IsFalse ( props . ContainsKey ( "NullableInteger" ) ) ;
172
- Assert . IsFalse ( props . ContainsKey ( "IntegerAsObject" ) ) ;
173
- Assert . IsFalse ( props . ContainsKey ( "Object" ) ) ;
174
- Assert . IsFalse ( props . ContainsKey ( "NullableDateTime" ) ) ;
175
- Assert . IsFalse ( props . ContainsKey ( "NullableStruct" ) ) ;
166
+ props . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
167
+ props . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
168
+ props . ContainsKey ( "Struct" ) . ShouldBeTrue ( ) ;
169
+ props . ContainsKey ( "StructPartiallyInitialized" ) . ShouldBeTrue ( ) ;
170
+
171
+ props . ContainsKey ( "String" ) . ShouldBeFalse ( ) ;
172
+ props . ContainsKey ( "NullableInteger" ) . ShouldBeFalse ( ) ;
173
+ props . ContainsKey ( "IntegerAsObject" ) . ShouldBeFalse ( ) ;
174
+ props . ContainsKey ( "Object" ) . ShouldBeFalse ( ) ;
175
+ props . ContainsKey ( "NullableDateTime" ) . ShouldBeFalse ( ) ;
176
+ props . ContainsKey ( "NullableStruct" ) . ShouldBeFalse ( ) ;
176
177
}
177
178
178
179
[ Test ]
@@ -223,54 +224,52 @@ public void NotLoggedIfNull_Initialized()
223
224
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
224
225
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
225
226
226
- Assert . IsTrue ( props . ContainsKey ( "String" ) ) ;
227
- Assert . IsTrue ( props . ContainsKey ( "Integer" ) ) ;
228
- Assert . IsTrue ( props . ContainsKey ( "NullableInteger" ) ) ;
229
- Assert . IsTrue ( props . ContainsKey ( "Object" ) ) ;
230
- Assert . IsTrue ( props . ContainsKey ( "IntegerAsObject" ) ) ;
231
- Assert . IsTrue ( props . ContainsKey ( "DateTime" ) ) ;
232
- Assert . IsTrue ( props . ContainsKey ( "NullableDateTime" ) ) ;
233
- Assert . IsTrue ( props . ContainsKey ( "Struct" ) ) ;
234
- Assert . IsTrue ( props . ContainsKey ( "NullableStruct" ) ) ;
235
- Assert . IsTrue ( props . ContainsKey ( "StructPartiallyInitialized" ) ) ;
236
-
237
- Assert . AreEqual ( "Foo" , props [ "String" ] . LiteralValue ( ) ) ;
238
- Assert . AreEqual ( 10 , props [ "Integer" ] . LiteralValue ( ) ) ;
239
- Assert . AreEqual ( 5 , props [ "NullableInteger" ] . LiteralValue ( ) ) ;
240
- Assert . AreEqual ( "Bar" , props [ "Object" ] . LiteralValue ( ) ) ;
241
- Assert . AreEqual ( 0 , props [ "IntegerAsObject" ] . LiteralValue ( ) ) ;
242
- Assert . AreEqual ( dateTime , props [ "DateTime" ] . LiteralValue ( ) ) ;
243
- Assert . AreEqual ( dateTime , props [ "NullableDateTime" ] . LiteralValue ( ) ) ;
244
- Assert . IsInstanceOf < StructureValue > ( props [ "Struct" ] ) ;
245
- Assert . IsInstanceOf < StructureValue > ( props [ "NullableStruct" ] ) ;
246
- Assert . IsInstanceOf < StructureValue > ( props [ "StructPartiallyInitialized" ] ) ;
247
-
248
- var structProps = ( ( StructureValue ) props [ "Struct" ] ) . Properties
249
- . ToDictionary ( p => p . Name , p => p . Value ) ;
250
-
251
- Assert . IsTrue ( structProps . ContainsKey ( "Integer" ) ) ;
252
- Assert . IsTrue ( structProps . ContainsKey ( "NullableInteger" ) ) ;
253
- Assert . IsTrue ( structProps . ContainsKey ( "DateTime" ) ) ;
254
- Assert . IsTrue ( structProps . ContainsKey ( "NullableDateTime" ) ) ;
255
- Assert . IsTrue ( structProps . ContainsKey ( "Object" ) ) ;
256
- Assert . AreEqual ( 20 , structProps [ "Integer" ] . LiteralValue ( ) ) ;
257
- Assert . AreEqual ( 15 , structProps [ "NullableInteger" ] . LiteralValue ( ) ) ;
258
- Assert . AreEqual ( dateTime , structProps [ "DateTime" ] . LiteralValue ( ) ) ;
259
- Assert . AreEqual ( dateTime , structProps [ "NullableDateTime" ] . LiteralValue ( ) ) ;
260
- Assert . AreEqual ( "Bar" , structProps [ "Object" ] . LiteralValue ( ) ) ;
261
-
262
- var partiallyItitializedProps = ( ( StructureValue ) props [ "StructPartiallyInitialized" ] ) . Properties
263
- . ToDictionary ( p => p . Name , p => p . Value ) ;
264
-
265
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "Integer" ) ) ;
266
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "NullableInteger" ) ) ;
267
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "DateTime" ) ) ;
268
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "NullableDateTime" ) ) ;
269
- Assert . IsFalse ( partiallyItitializedProps . ContainsKey ( "Object" ) ) ;
270
- Assert . AreEqual ( 20 , partiallyItitializedProps [ "Integer" ] . LiteralValue ( ) ) ;
271
- Assert . AreEqual ( 15 , partiallyItitializedProps [ "NullableInteger" ] . LiteralValue ( ) ) ;
272
- Assert . AreEqual ( dateTime , partiallyItitializedProps [ "DateTime" ] . LiteralValue ( ) ) ;
273
- Assert . AreEqual ( dateTime , partiallyItitializedProps [ "NullableDateTime" ] . LiteralValue ( ) ) ;
227
+ props . ContainsKey ( "String" ) . ShouldBeTrue ( ) ;
228
+ props . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
229
+ props . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
230
+ props . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
231
+ props . ContainsKey ( "IntegerAsObject" ) . ShouldBeTrue ( ) ;
232
+ props . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
233
+ props . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
234
+ props . ContainsKey ( "Struct" ) . ShouldBeTrue ( ) ;
235
+ props . ContainsKey ( "NullableStruct" ) . ShouldBeTrue ( ) ;
236
+ props . ContainsKey ( "StructPartiallyInitialized" ) . ShouldBeTrue ( ) ;
237
+
238
+ props [ "String" ] . LiteralValue ( ) . ShouldBe ( "Foo" ) ;
239
+ props [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 10 ) ;
240
+ props [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 5 ) ;
241
+ props [ "Object" ] . LiteralValue ( ) . ShouldBe ( "Bar" ) ;
242
+ props [ "IntegerAsObject" ] . LiteralValue ( ) . ShouldBe ( 0 ) ;
243
+ props [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
244
+ props [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
245
+ props [ "Struct" ] . ShouldBeOfType < StructureValue > ( ) ;
246
+ props [ "NullableStruct" ] . ShouldBeOfType < StructureValue > ( ) ;
247
+ props [ "StructPartiallyInitialized" ] . ShouldBeOfType < StructureValue > ( ) ;
248
+
249
+ var structProps = ( ( StructureValue ) props [ "Struct" ] ) . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
250
+
251
+ structProps . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
252
+ structProps . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
253
+ structProps . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
254
+ structProps . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
255
+ structProps . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
256
+ structProps [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 20 ) ;
257
+ structProps [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 15 ) ;
258
+ structProps [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
259
+ structProps [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
260
+ structProps [ "Object" ] . LiteralValue ( ) . ShouldBe ( "Bar" ) ;
261
+
262
+ var partiallyItitializedProps = ( ( StructureValue ) props [ "StructPartiallyInitialized" ] ) . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
263
+
264
+ partiallyItitializedProps . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
265
+ partiallyItitializedProps . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
266
+ partiallyItitializedProps . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
267
+ partiallyItitializedProps . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
268
+ partiallyItitializedProps . ContainsKey ( "Object" ) . ShouldBeFalse ( ) ;
269
+ partiallyItitializedProps [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 20 ) ;
270
+ partiallyItitializedProps [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 15 ) ;
271
+ partiallyItitializedProps [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
272
+ partiallyItitializedProps [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
274
273
}
275
274
276
275
[ Test ]
@@ -290,8 +289,8 @@ public void WithMask_NotLoggedIfNull_Uninitialized()
290
289
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
291
290
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
292
291
293
- Assert . IsFalse ( props . ContainsKey ( "String" ) ) ;
294
- Assert . IsFalse ( props . ContainsKey ( "Object" ) ) ;
292
+ props . ContainsKey ( "String" ) . ShouldBeFalse ( ) ;
293
+ props . ContainsKey ( "Object" ) . ShouldBeFalse ( ) ;
295
294
}
296
295
297
296
[ Test ]
@@ -316,11 +315,11 @@ public void WithMask_NotLoggedIfNull_Initialized()
316
315
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
317
316
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
318
317
319
- Assert . IsTrue ( props . ContainsKey ( "String" ) ) ;
320
- Assert . IsTrue ( props . ContainsKey ( "Object" ) ) ;
318
+ props . ContainsKey ( "String" ) . ShouldBeTrue ( ) ;
319
+ props . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
321
320
322
- Assert . AreEqual ( "Foo***" , props [ "String" ] . LiteralValue ( ) ) ;
323
- Assert . AreEqual ( "Bar***" , props [ "Object" ] . LiteralValue ( ) ) ;
321
+ props [ "String" ] . LiteralValue ( ) . ShouldBe ( "Foo***" ) ;
322
+ props [ "Object" ] . LiteralValue ( ) . ShouldBe ( "Bar***" ) ;
324
323
}
325
324
326
325
[ Test ]
@@ -345,7 +344,7 @@ public void EnumerableIgnored()
345
344
log . Information ( "Here is {@Customized}" , customized ) ;
346
345
347
346
var sv = evt ! . Properties [ "Customized" ] ;
348
- Assert . IsInstanceOf < SequenceValue > ( sv ) ;
347
+ sv . ShouldBeOfType < SequenceValue > ( ) ;
349
348
}
350
349
351
350
[ Test ]
@@ -373,15 +372,14 @@ public void EnumerableDestructedAsStruct()
373
372
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
374
373
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
375
374
376
- Assert . IsTrue ( props . ContainsKey ( "Integer" ) ) ;
377
- Assert . IsFalse ( props . ContainsKey ( "NullableInteger" ) ) ;
378
- Assert . IsTrue ( props . ContainsKey ( "Dependency" ) ) ;
375
+ props . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
376
+ props . ContainsKey ( "NullableInteger" ) . ShouldBeFalse ( ) ;
377
+ props . ContainsKey ( "Dependency" ) . ShouldBeTrue ( ) ;
379
378
380
- var dependencyProps = ( ( StructureValue ) props [ "Dependency" ] ) . Properties
381
- . ToDictionary ( p => p . Name , p => p . Value ) ;
379
+ var dependencyProps = ( ( StructureValue ) props [ "Dependency" ] ) . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
382
380
383
- Assert . IsTrue ( dependencyProps . ContainsKey ( "Integer" ) ) ;
384
- Assert . IsFalse ( dependencyProps . ContainsKey ( "NullableInteger" ) ) ;
381
+ dependencyProps . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
382
+ dependencyProps . ContainsKey ( "NullableInteger" ) . ShouldBeFalse ( ) ;
385
383
}
386
384
387
385
[ Test ]
@@ -401,17 +399,17 @@ public void NotLoggedIfNullAttribute_Uninitialized()
401
399
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
402
400
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
403
401
404
- Assert . IsTrue ( props . ContainsKey ( "Integer" ) ) ;
405
- Assert . IsTrue ( props . ContainsKey ( "DateTime" ) ) ;
406
- Assert . IsTrue ( props . ContainsKey ( "Struct" ) ) ;
407
- Assert . IsTrue ( props . ContainsKey ( "StructPartiallyInitialized" ) ) ;
408
-
409
- Assert . IsFalse ( props . ContainsKey ( "String" ) ) ;
410
- Assert . IsFalse ( props . ContainsKey ( "NullableInteger" ) ) ;
411
- Assert . IsFalse ( props . ContainsKey ( "IntegerAsObject" ) ) ;
412
- Assert . IsFalse ( props . ContainsKey ( "Object" ) ) ;
413
- Assert . IsFalse ( props . ContainsKey ( "NullableDateTime" ) ) ;
414
- Assert . IsFalse ( props . ContainsKey ( "NullableStruct" ) ) ;
402
+ props . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
403
+ props . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
404
+ props . ContainsKey ( "Struct" ) . ShouldBeTrue ( ) ;
405
+ props . ContainsKey ( "StructPartiallyInitialized" ) . ShouldBeTrue ( ) ;
406
+
407
+ props . ContainsKey ( "String" ) . ShouldBeFalse ( ) ;
408
+ props . ContainsKey ( "NullableInteger" ) . ShouldBeFalse ( ) ;
409
+ props . ContainsKey ( "IntegerAsObject" ) . ShouldBeFalse ( ) ;
410
+ props . ContainsKey ( "Object" ) . ShouldBeFalse ( ) ;
411
+ props . ContainsKey ( "NullableDateTime" ) . ShouldBeFalse ( ) ;
412
+ props . ContainsKey ( "NullableStruct" ) . ShouldBeFalse ( ) ;
415
413
}
416
414
417
415
[ Test ]
@@ -462,57 +460,53 @@ public void NotLoggedIfNullAttribute_Initialized()
462
460
var sv = ( StructureValue ) evt ! . Properties [ "Customized" ] ;
463
461
var props = sv . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
464
462
465
- Assert . IsTrue ( props . ContainsKey ( "String" ) ) ;
466
- Assert . IsTrue ( props . ContainsKey ( "Integer" ) ) ;
467
- Assert . IsTrue ( props . ContainsKey ( "NullableInteger" ) ) ;
468
- Assert . IsTrue ( props . ContainsKey ( "Object" ) ) ;
469
- Assert . IsTrue ( props . ContainsKey ( "IntegerAsObject" ) ) ;
470
- Assert . IsTrue ( props . ContainsKey ( "DateTime" ) ) ;
471
- Assert . IsTrue ( props . ContainsKey ( "NullableDateTime" ) ) ;
472
- Assert . IsTrue ( props . ContainsKey ( "Struct" ) ) ;
473
- Assert . IsTrue ( props . ContainsKey ( "NullableStruct" ) ) ;
474
- Assert . IsTrue ( props . ContainsKey ( "StructPartiallyInitialized" ) ) ;
475
-
476
- Assert . AreEqual ( "Foo" , props [ "String" ] . LiteralValue ( ) ) ;
477
- Assert . AreEqual ( 10 , props [ "Integer" ] . LiteralValue ( ) ) ;
478
- Assert . AreEqual ( 5 , props [ "NullableInteger" ] . LiteralValue ( ) ) ;
479
- Assert . AreEqual ( "Bar" , props [ "Object" ] . LiteralValue ( ) ) ;
480
- Assert . AreEqual ( 0 , props [ "IntegerAsObject" ] . LiteralValue ( ) ) ;
481
- Assert . AreEqual ( dateTime , props [ "DateTime" ] . LiteralValue ( ) ) ;
482
- Assert . AreEqual ( dateTime , props [ "NullableDateTime" ] . LiteralValue ( ) ) ;
483
- Assert . IsInstanceOf < StructureValue > ( props [ "Struct" ] ) ;
484
- Assert . IsInstanceOf < StructureValue > ( props [ "NullableStruct" ] ) ;
485
- Assert . IsInstanceOf < StructureValue > ( props [ "StructPartiallyInitialized" ] ) ;
486
-
487
- var structProps = ( ( StructureValue ) props [ "Struct" ] ) . Properties
488
- . ToDictionary ( p => p . Name , p => p . Value ) ;
489
-
490
- Assert . IsTrue ( structProps . ContainsKey ( "Integer" ) ) ;
491
- Assert . IsTrue ( structProps . ContainsKey ( "NullableInteger" ) ) ;
492
- Assert . IsTrue ( structProps . ContainsKey ( "DateTime" ) ) ;
493
- Assert . IsTrue ( structProps . ContainsKey ( "NullableDateTime" ) ) ;
494
- Assert . IsTrue ( structProps . ContainsKey ( "Object" ) ) ;
495
- Assert . AreEqual ( 20 , structProps [ "Integer" ] . LiteralValue ( ) ) ;
496
- Assert . AreEqual ( 15 , structProps [ "NullableInteger" ] . LiteralValue ( ) ) ;
497
- Assert . AreEqual ( dateTime , structProps [ "DateTime" ] . LiteralValue ( ) ) ;
498
- Assert . AreEqual ( dateTime , structProps [ "NullableDateTime" ] . LiteralValue ( ) ) ;
499
- Assert . AreEqual ( "Bar" , structProps [ "Object" ] . LiteralValue ( ) ) ;
500
-
501
- var partiallyItitializedProps = ( ( StructureValue ) props [ "StructPartiallyInitialized" ] ) . Properties
502
- . ToDictionary ( p => p . Name , p => p . Value ) ;
503
-
504
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "Integer" ) ) ;
505
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "NullableInteger" ) ) ;
506
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "DateTime" ) ) ;
507
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "NullableDateTime" ) ) ;
508
- Assert . IsTrue ( partiallyItitializedProps . ContainsKey ( "Object" ) ) ;
509
- Assert . AreEqual ( 20 , partiallyItitializedProps [ "Integer" ] . LiteralValue ( ) ) ;
510
- Assert . AreEqual ( 15 , partiallyItitializedProps [ "NullableInteger" ] . LiteralValue ( ) ) ;
511
- Assert . AreEqual ( dateTime , partiallyItitializedProps [ "DateTime" ] . LiteralValue ( ) ) ;
512
- Assert . AreEqual ( dateTime , partiallyItitializedProps [ "NullableDateTime" ] . LiteralValue ( ) ) ;
513
-
463
+ props . ContainsKey ( "String" ) . ShouldBeTrue ( ) ;
464
+ props . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
465
+ props . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
466
+ props . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
467
+ props . ContainsKey ( "IntegerAsObject" ) . ShouldBeTrue ( ) ;
468
+ props . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
469
+ props . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
470
+ props . ContainsKey ( "Struct" ) . ShouldBeTrue ( ) ;
471
+ props . ContainsKey ( "NullableStruct" ) . ShouldBeTrue ( ) ;
472
+ props . ContainsKey ( "StructPartiallyInitialized" ) . ShouldBeTrue ( ) ;
473
+
474
+ props [ "String" ] . LiteralValue ( ) . ShouldBe ( "Foo" ) ;
475
+ props [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 10 ) ;
476
+ props [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 5 ) ;
477
+ props [ "Object" ] . LiteralValue ( ) . ShouldBe ( "Bar" ) ;
478
+ props [ "IntegerAsObject" ] . LiteralValue ( ) . ShouldBe ( 0 ) ;
479
+ props [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
480
+ props [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
481
+ props [ "Struct" ] . ShouldBeOfType < StructureValue > ( ) ;
482
+ props [ "NullableStruct" ] . ShouldBeOfType < StructureValue > ( ) ;
483
+ props [ "StructPartiallyInitialized" ] . ShouldBeOfType < StructureValue > ( ) ;
484
+
485
+ var structProps = ( ( StructureValue ) props [ "Struct" ] ) . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
486
+
487
+ structProps . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
488
+ structProps . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
489
+ structProps . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
490
+ structProps . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
491
+ structProps . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
492
+ structProps [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 20 ) ;
493
+ structProps [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 15 ) ;
494
+ structProps [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
495
+ structProps [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
496
+ structProps [ "Object" ] . LiteralValue ( ) . ShouldBe ( "Bar" ) ;
497
+
498
+ var partiallyItitializedProps = ( ( StructureValue ) props [ "StructPartiallyInitialized" ] ) . Properties . ToDictionary ( p => p . Name , p => p . Value ) ;
499
+
500
+ partiallyItitializedProps . ContainsKey ( "Integer" ) . ShouldBeTrue ( ) ;
501
+ partiallyItitializedProps . ContainsKey ( "NullableInteger" ) . ShouldBeTrue ( ) ;
502
+ partiallyItitializedProps . ContainsKey ( "DateTime" ) . ShouldBeTrue ( ) ;
503
+ partiallyItitializedProps . ContainsKey ( "NullableDateTime" ) . ShouldBeTrue ( ) ;
504
+ partiallyItitializedProps . ContainsKey ( "Object" ) . ShouldBeTrue ( ) ;
505
+ partiallyItitializedProps [ "Integer" ] . LiteralValue ( ) . ShouldBe ( 20 ) ;
506
+ partiallyItitializedProps [ "NullableInteger" ] . LiteralValue ( ) . ShouldBe ( 15 ) ;
507
+ partiallyItitializedProps [ "DateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
508
+ partiallyItitializedProps [ "NullableDateTime" ] . LiteralValue ( ) . ShouldBe ( dateTime ) ;
514
509
}
515
-
516
510
}
517
511
518
512
0 commit comments