public async Task DeletedEntityIsMarkedAndNotRemoved() { using (var context = TestContextProvider.GetContext("DeletedEntity")) { context.Add(new Salesperson() { Id = 1, Deleted = false }); await context.SaveChangesAsync(); var repo = new TrackingRepository <Salesperson>(context); await repo.Delete(1); await repo.SaveChanges(); } using (var context = TestContextProvider.GetContext("DeletedEntity")) { var person = context.Find <Salesperson>(1); Assert.IsTrue(person.Deleted, "The person should be marked deleted"); } }
public async Task PartialLastNameIsCaseInsensitive() { using (var context = TestContextProvider.GetContext("LastNameCaseTest")) { context.AddRange(new Order[] { new Order() { Customer = new Customer() { LastName = "Smithy" } }, new Order() { Customer = new Customer() { LastName = "Smithers" } }, new Order() { Customer = new Customer() { LastName = "Smithson" } }, new Order() { Customer = new Customer() { LastName = "McSmith" } }, new Order() { Customer = new Customer() { LastName = "SMITH" } }, new Order() { Customer = new Customer() { LastName = "smi" } }, }); await context.SaveChangesAsync(); } using (var context = TestContextProvider.GetContext("LastNameCaseTest")) { var repo = new OrderRepository(context); Assert.AreEqual(6, (await repo.GetByCustomerPartialLastName("smi")).Count); Assert.AreEqual(5, (await repo.GetByCustomerPartialLastName("smith")).Count); Assert.AreEqual(1, (await repo.GetByCustomerPartialLastName("MC")).Count); } }