diff --git a/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs b/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs index a7def00cdd..dd7eccde65 100644 --- a/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs +++ b/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs @@ -76,18 +76,15 @@ public void RealmValue_AsMappedType_WhenTypeIsIncorrect_Throws() public void AccessMappedTypeProperties_ReadsValuesFromBackingStorage() { AddData(); - var dogContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Dog)); - var dog = new Dog(); - dog.SetBackingStorage(dogContainer.MixedDict); + var dogContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Dog)); + var dog = dogContainer.MixedProperty.As(); Assert.That(dog.Name, Is.EqualTo("Fido")); Assert.That(dog.BarkCount, Is.EqualTo(5)); var birdContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Bird)); - - var bird = new Bird(); - bird.SetBackingStorage(birdContainer.MixedDict); + var bird = birdContainer.MixedProperty.As(); Assert.That(bird.Name, Is.EqualTo("Tweety")); Assert.That(bird.CanFly, Is.True); @@ -113,10 +110,9 @@ public void AccessMappedTypeProperties_WhenNonExistent_Throws() public void UpdateMappedTypeProperties_WritesValuesToBackingStorage() { AddData(); - var dogContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Dog)); - var dog = new Dog(); - dog.SetBackingStorage(dogContainer.MixedDict); + var dogContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Dog)); + var dog = dogContainer.MixedProperty.As(); _realm.Write(() => { @@ -127,9 +123,7 @@ public void UpdateMappedTypeProperties_WritesValuesToBackingStorage() Assert.That(dog.BarkCount, Is.EqualTo(6)); var birdContainer = _realm.All().First(c => c.ContainedObjectType == nameof(Bird)); - - var bird = new Bird(); - bird.SetBackingStorage(birdContainer.MixedDict); + var bird = birdContainer.MixedProperty.As(); _realm.Write(() => {