public async Task Should_Create_Area_And_Upsert_Finally_do_Delete() { 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); //Act var middlewareManager = new MiddlewareManager <Area>(new BaseRecordManager <Area>(), new AreaValidator()); //Asserts //Get var result = await middlewareManager .GetByIdsAsync(Areas.Select(p => p.ID).ToList(), identityWorkId); Assert.True(result.Any()); var AreasToInsert = new AreaManagerUT().Build <Area>(identityWorkId, instanceId); AreasToInsert.AddRange(result); //upsert await middlewareManager.CreateorUpdateAsync(AreasToInsert, identityWorkId); result = await middlewareManager .GetByIdsAsync(AreasToInsert.Select(p => p.ID).ToList(), identityWorkId); Assert.True(result.Count() == 2); //Delete await middlewareManager.DeleteAsync(AreasToInsert.Select(p => p.ID).ToList(), identityWorkId); //Get it again to verify if the registry it was deleted var result2 = await middlewareManager .GetByIdsAsync(AreasToInsert.Select(p => p.ID).ToList(), identityWorkId); Assert.True(!result2.Any()); }