@@ -76,18 +76,15 @@ public void RealmValue_AsMappedType_WhenTypeIsIncorrect_Throws()
7676 public void AccessMappedTypeProperties_ReadsValuesFromBackingStorage ( )
7777 {
7878 AddData ( ) ;
79- var dogContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Dog ) ) ;
8079
81- var dog = new Dog ( ) ;
82- dog . SetBackingStorage ( dogContainer . MixedDict ) ;
80+ var dogContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Dog ) ) ;
81+ var dog = dogContainer . MixedProperty . As < Dog > ( ) ;
8382
8483 Assert . That ( dog . Name , Is . EqualTo ( "Fido" ) ) ;
8584 Assert . That ( dog . BarkCount , Is . EqualTo ( 5 ) ) ;
8685
8786 var birdContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Bird ) ) ;
88-
89- var bird = new Bird ( ) ;
90- bird . SetBackingStorage ( birdContainer . MixedDict ) ;
87+ var bird = birdContainer . MixedProperty . As < Bird > ( ) ;
9188
9289 Assert . That ( bird . Name , Is . EqualTo ( "Tweety" ) ) ;
9390 Assert . That ( bird . CanFly , Is . True ) ;
@@ -113,10 +110,9 @@ public void AccessMappedTypeProperties_WhenNonExistent_Throws()
113110 public void UpdateMappedTypeProperties_WritesValuesToBackingStorage ( )
114111 {
115112 AddData ( ) ;
116- var dogContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Dog ) ) ;
117113
118- var dog = new Dog ( ) ;
119- dog . SetBackingStorage ( dogContainer . MixedDict ) ;
114+ var dogContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Dog ) ) ;
115+ var dog = dogContainer . MixedProperty . As < Dog > ( ) ;
120116
121117 _realm . Write ( ( ) =>
122118 {
@@ -127,9 +123,7 @@ public void UpdateMappedTypeProperties_WritesValuesToBackingStorage()
127123 Assert . That ( dog . BarkCount , Is . EqualTo ( 6 ) ) ;
128124
129125 var birdContainer = _realm . All < FlexibleSchemaPocContainer > ( ) . First ( c => c . ContainedObjectType == nameof ( Bird ) ) ;
130-
131- var bird = new Bird ( ) ;
132- bird . SetBackingStorage ( birdContainer . MixedDict ) ;
126+ var bird = birdContainer . MixedProperty . As < Bird > ( ) ;
133127
134128 _realm . Write ( ( ) =>
135129 {
0 commit comments