public async Task RollbackAsync_Success_Should_DoNothing_Detail_NoTransactionToRollback() { var expCount = 0; var aggregateRep = Mock.Of <IRepositoryAsync <TestAggregateRoot, Guid> >(); ITestUnitOfWork unitOfWork = new TestUnitOfWork(_Context, aggregateRep); await unitOfWork.RollbackAsync(); _Context.TestAggregateRoots.Should().HaveCount(expCount); }
public async Task RollbackAsync_Success_Should_RollbackTransaction() { var expCount = 0; var aggregateRep = Mock.Of <IRepositoryAsync <TestAggregateRoot, Guid> >(); ITestUnitOfWork unitOfWork = new TestUnitOfWork(_Context, aggregateRep); await unitOfWork.CreateTransactionAsync(); var aggregateRoot = new TestAggregateRoot("testing"); _Context.Add(aggregateRoot); await _Context.SaveChangesAsync(); _Context.ChangeTracker.Clear(); await unitOfWork.RollbackAsync(); _Context.TestAggregateRoots.Should().HaveCount(expCount); }