@@ -1309,9 +1309,9 @@ public HazGetOnlyAndCtor(int idProperty, string nameProperty)
1309
1309
IdProperty = idProperty ;
1310
1310
NameProperty = nameProperty ;
1311
1311
}
1312
- }
1313
-
1314
- [ Fact ]
1312
+ }
1313
+
1314
+ [ Fact ]
1315
1315
public void Issue1164_OverflowExceptionForByte ( )
1316
1316
{
1317
1317
const string sql = "select cast(200 as smallint) as [value]" ; // 200 more than sbyte.MaxValue but less than byte.MaxValue
@@ -1358,5 +1358,41 @@ public async Task QuerySplitStruct() // https://github.com/DapperLib/Dapper/issu
1358
1358
1359
1359
Assert . Single ( results ) ;
1360
1360
}
1361
+
1362
+ [ Fact ]
1363
+ public void SetDynamicProperty_WithReferenceType_Succeeds ( )
1364
+ {
1365
+ var obj = connection . QueryFirst ( "select 1 as ExistingProperty" ) ;
1366
+
1367
+ obj . ExistingProperty = "foo" ;
1368
+ Assert . Equal ( "foo" , ( string ) obj . ExistingProperty ) ;
1369
+
1370
+ obj . NewProperty = new Uri ( "http://example.net/" ) ;
1371
+ Assert . Equal ( new Uri ( "http://example.net/" ) , ( Uri ) obj . NewProperty ) ;
1372
+ }
1373
+
1374
+ [ Fact ]
1375
+ public void SetDynamicProperty_WithBoxedValueType_Succeeds ( )
1376
+ {
1377
+ var obj = connection . QueryFirst ( "select 'foo' as ExistingProperty" ) ;
1378
+
1379
+ obj . ExistingProperty = ( object ) 1 ;
1380
+ Assert . Equal ( 1 , ( int ) obj . ExistingProperty ) ;
1381
+
1382
+ obj . NewProperty = ( object ) true ;
1383
+ Assert . True ( obj . NewProperty ) ;
1384
+ }
1385
+
1386
+ [ Fact ]
1387
+ public void SetDynamicProperty_WithValueType_Succeeds ( )
1388
+ {
1389
+ var obj = connection . QueryFirst ( "select 'foo' as ExistingProperty" ) ;
1390
+
1391
+ obj . ExistingProperty = 1 ;
1392
+ Assert . Equal ( 1 , ( int ) obj . ExistingProperty ) ;
1393
+
1394
+ obj . NewProperty = true ;
1395
+ Assert . True ( obj . NewProperty ) ;
1396
+ }
1361
1397
}
1362
1398
}
0 commit comments