public void TestHardDeleteCascadeDeleteCompanySomeQuotesDifferentUserIdOk() { //SETUP var userId = Guid.NewGuid(); var options = SqliteInMemory.CreateOptions <CascadeSoftDelDbContext>(); using (var context = new CascadeSoftDelDbContext(options, userId)) { context.Database.EnsureCreated(); var customerId = Customer.SeedCustomerWithQuotes(context, userId).Id; Customer.SeedCustomerWithQuotes(context, Guid.Empty, "Other customer"); context.ChangeTracker.Clear(); var config = new ConfigCascadeDeleteWithUserId(context); var service = new CascadeSoftDelService <ICascadeSoftDelete>(config); service.SetCascadeSoftDeleteViaKeys <Customer>(customerId).Result.ShouldEqual(1 + 4 + 4 + (4 * 4)); //ATTEMPT var status = service.HardDeleteSoftDeletedEntriesViaKeys <Customer>(customerId); //VERIFY status.IsValid.ShouldBeTrue(status.GetAllErrors()); status.Result.ShouldEqual(1 + 4 + 4 + (4 * 4)); status.Message.ShouldEqual("You have hard deleted an entity and its 24 dependents"); context.ChangeTracker.Clear(); context.Quotes.Count().ShouldEqual(0); context.Quotes.IgnoreQueryFilters().Count().ShouldEqual(4); } }