Database doesn't detect unique indexes with memory context
Closed this issue · 1 comments
BobbyCannon commented
Adding entities with duplicate Name with Unique constraints are passing validation. This should not be passing validation.
using var database = provider.GetDatabase();
database.Food.Add(FoodFactory.Get(x => x.Name = "Bread"));
database.Food.Add(FoodFactory.Get(x => x.Name = "Bread"));
TestHelper.ExpectedException<Exception>(() => database.SaveChanges(),
"Cannot insert duplicate key row in object 'dbo.Foods' with unique index 'IX_Foods_Name'. The duplicate key value is (Bread)",
"SQLite Error 19: 'UNIQUE constraint failed: Foods.Name'"
);
BobbyCannon commented
Fixed in 6.1.4-RC