BobbyCannon/Speedy

Database doesn't detect unique indexes with memory context

Closed this issue · 1 comments

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'"
);

Fixed in 6.1.4-RC