public async Task CommitRollbackUnitOfWork1() { var unitOfWork = new InmemoryUnitOfWork(); var set = await unitOfWork.CreateSet <Account>(); var account = new Account { Email = this.UniqueEmail, Name = "misha" }; account.EnsureIdentity(); set.Add(account.Id, account); await unitOfWork.Commit(); var set1 = await unitOfWork.CreateSet <Account>(); var count = set1.Count; var account1 = new Account { Email = this.UniqueEmail, Name = "misha" }; account1.EnsureIdentity(); set1.Add(account1.Id, account1); await unitOfWork.Rollback(); var set3 = await unitOfWork.CreateSet <Account>(); Assert.AreEqual(count, set3.Count); }
public async Task CommitByRelationsUnitOfWork() { var unitOfWork = new InmemoryUnitOfWork(); var set = await unitOfWork.CreateSet <Account>(); var account = new Account { Email = this.UniqueEmail, Name = "misha" }; account.EnsureIdentity(); set.Add(account.Id, account); var count = set.Count; await unitOfWork.Commit(); Assert.AreEqual(count, set.Count); }