public async Task TestGetSoftDeletedEntriesEmployeeSoftDeletedOk() { //SETUP var options = SqliteInMemory.CreateOptions <CascadeSoftDelDbContext>(); using (var context = new CascadeSoftDelDbContext(options)) { context.Database.EnsureCreated(); var ceo = Employee.SeedEmployeeSoftDel(context); var config = new ConfigCascadeDeleteWithUserId(context); var service = new CascadeSoftDelServiceAsync <ICascadeSoftDelete>(config); (await service.SetCascadeSoftDeleteAsync(ceo.WorksFromMe.First())).IsValid.ShouldBeTrue(); //ATTEMPT var softDeleted = await service.GetSoftDeletedEntries <Employee>().ToListAsync(); //VERIFY softDeleted.Count.ShouldEqual(1); softDeleted.Single().Name.ShouldEqual(ceo.WorksFromMe.First().Name); } }
public async Task TestGetSoftDeletedEntriesCompanyOk() { //SETUP var userId = Guid.NewGuid(); var options = SqliteInMemory.CreateOptions <CascadeSoftDelDbContext>(); using (var context = new CascadeSoftDelDbContext(options, userId)) { context.Database.EnsureCreated(); var company = Customer.SeedCustomerWithQuotes(context, userId); var config = new ConfigCascadeDeleteWithUserId(context); var service = new CascadeSoftDelServiceAsync <ICascadeSoftDelete>(config); var status = await service.SetCascadeSoftDeleteAsync(company); //ATTEMPT var softDeleted = await service.GetSoftDeletedEntries <Customer>().ToListAsync(); //VERIFY softDeleted.Count.ShouldEqual(1); softDeleted.Single().CompanyName.ShouldEqual(company.CompanyName); } }