diff --git a/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs b/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs index 6415d19212..9615db93c2 100644 --- a/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs +++ b/Tests/Realm.Tests/Database/FlexibleSchemaPocTests.cs @@ -77,18 +77,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); @@ -114,10 +111,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(() => { @@ -128,9 +124,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(() => {