public void Can_use_computed_columns_with_nullable_enum() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkNpgsql() .BuildServiceProvider(); using var context = new NullableContext(serviceProvider, TestStore.Name); context.Database.EnsureCreatedResiliently(); var entity = context.EnumItems.Add(new EnumItem { FlagEnum = FlagEnum.AValue, OptionalFlagEnum = FlagEnum.BValue }).Entity; context.SaveChanges(); Assert.Equal(FlagEnum.AValue | FlagEnum.BValue, entity.CalculatedFlagEnum); }
public void Can_use_computed_columns_with_nullable_enum() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlServer() .BuildServiceProvider(); using (var context = new NullableContext(serviceProvider, "NullableEnumComputedColumns")) { context.Database.EnsureClean(); var entity = context.EnumItems.Add(new EnumItem { FlagEnum = FlagEnum.AValue, OptionalFlagEnum = FlagEnum.BValue }).Entity; context.SaveChanges(); Assert.Equal(FlagEnum.AValue | FlagEnum.BValue, entity.CalculatedFlagEnum); } }
public void Can_use_computed_columns_with_nullable_enum() { var serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlServer() .ServiceCollection() .BuildServiceProvider(); using (var context = new NullableContext(serviceProvider, "NullableEnumComputedColumns")) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var entity = context.EnumItems.Add(new EnumItem { FlagEnum = FlagEnum.AValue, OptionalFlagEnum = FlagEnum.BValue }).Entity; context.SaveChanges(); Assert.Equal(FlagEnum.AValue | FlagEnum.BValue, entity.CalculatedFlagEnum); } }