public void Can_save_entities_with_int_discriminators() { using (var context = new Context4285()) { context.AddRange( new SubIntProduct { SomeName = "One" }, new SubIntProduct2 { SomeName2 = "Two" }); context.SaveChanges(); } using (var context = new Context4285()) { var products = context.IntProducts.ToList(); var productOne = products.OfType <SubIntProduct>().Single(); Assert.Equal("One", productOne.SomeName); Assert.Equal(1, context.Entry(productOne).Property <int>("IntDiscriminator").CurrentValue); var productTwo = products.OfType <SubIntProduct2>().Single(); Assert.Equal("Two", productTwo.SomeName2); Assert.Equal(2, context.Entry(productTwo).Property <int>("IntDiscriminator").CurrentValue); } }
public void Can_save_enities_with_int_discriminators() { using (var context = new Context4285()) { context.AddRange(new SubIntProduct { SomeName = "One" }, new SubIntProduct2 { SomeName2 = "Two" }); context.SaveChanges(); } using (var context = new Context4285()) { var products = context.IntProducts.ToList(); Assert.Equal("One", products.OfType<SubIntProduct>().Single().SomeName); Assert.Equal("Two", products.OfType<SubIntProduct2>().Single().SomeName2); } }
public void Can_save_enities_with_int_discriminators() { using (var context = new Context4285()) { context.AddRange(new SubIntProduct { SomeName = "One" }, new SubIntProduct2 { SomeName2 = "Two" }); context.SaveChanges(); } using (var context = new Context4285()) { var products = context.IntProducts.ToList(); Assert.Equal("One", products.OfType <SubIntProduct>().Single().SomeName); Assert.Equal("Two", products.OfType <SubIntProduct2>().Single().SomeName2); } }