public async Task Should_Delete_all() { using var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); //Arrange var identityWorkId = Guid.NewGuid(); var instanceId = Guid.NewGuid(); var Areas = await new AreaManagerUT().CreateDefaultAsync <Area>(identityWorkId, instanceId); var Departments = await new DepartmentManagerUT().CreateDefaultAsync <Department>(identityWorkId, instanceId); Departments.FirstOrDefault().AreaID = Areas.FirstOrDefault().ID; //Act var middlewareManager = new MiddlewareManager <Department>(new BaseRecordManager <Department>(), new DepartmentValidator()); //Asserts //Get var result = await middlewareManager .GetByIdsAsync(Departments.Select(p => p.ID).ToList(), identityWorkId); Assert.True(result.Any()); //Delete await middlewareManager.DeleteAllAsync(identityWorkId, instanceId); Assert.True(result.FirstOrDefault().ID == Departments.FirstOrDefault().ID); //Get it again to verify if the registry was deleted var result2 = await middlewareManager .GetByIdsAsync(Departments.Select(p => p.ID).ToList(), identityWorkId); Assert.True(!result2.Any()); }