public void StoreAndLoadStringInheritedTypes() { using (var trn = Store.BeginTransaction()) { var brandA = new BrandA { Name = "Brand A", Description = "Details for Brand A." }; var brandB = new BrandB { Name = "Brand B", Description = "Details for Brand B." }; trn.Insert <Brand>(brandA); trn.Insert <Brand>(brandB); trn.Commit(); var allBrands = trn.TableQuery <Brand>().ToList(); allBrands.SingleOrDefault(x => x.Name == "Brand A").Should().NotBeNull("Didn't retrieve BrandA"); allBrands.Single(x => x.Name == "Brand A").Should().BeOfType <BrandA>(); } }
public void StoreStringInheritedTypesSerializeCorrectly() { using (var trn = Store.BeginTransaction()) { var brandA = new BrandA { Name = "Brand A", Description = "Details for Brand A." }; var brandB = new BrandB { Name = "Brand B", Description = "Details for Brand B." }; trn.Insert <Brand>(brandA); trn.Insert <Brand>(brandB); trn.Commit(); var allBrands = trn.TableQuery <BrandToTestSerialization>().ToList(); allBrands.SingleOrDefault(x => x.Name == "Brand A").Should().NotBeNull("Didn't retrieve BrandA"); var brandToTestSerialization = allBrands.Single(x => x.Name == "Brand A"); brandToTestSerialization.JSON.Should().Be("{\"Type\":\"BrandA\",\"Description\":\"Details for Brand A.\"}"); } }