public void OptimisticLockTest() { var aggregate = new EventAggregate(); using (var tran = aggregate.BeginTransaction()) { aggregate.Push(0, "test1"); aggregate.Push(0, "test2"); } }
public void GetAllNextSuccessfullTest(int count, int startingFrom) { var aggregate = new EventAggregate(); using (var tran = aggregate.BeginTransaction()) { for (int i = 0; i < count; i++) { aggregate.Push(i, "test" + i); } tran.Commit(); } var result = aggregate.GetAllNext(startingFrom); Assert.AreEqual(count - startingFrom - 1, result.Count()); }
public void CommitTest() { var tranCounter = ServerClass.TransactionCounter; var aggregate = new EventAggregate(); Assert.AreEqual(0, aggregate.LastVersion); Assert.IsFalse(aggregate.HasUncommitedChanges); using (var tran = aggregate.BeginTransaction()) { aggregate.Push(-1, new object()); Assert.IsTrue(aggregate.HasUncommitedChanges); Assert.AreEqual(1, aggregate.LastVersion); tran.Commit(); } Assert.IsFalse(aggregate.HasUncommitedChanges); Assert.AreEqual(tranCounter + 1, ServerClass.TransactionCounter); Assert.AreEqual(1, aggregate.LastVersion); }
public void TryGetNextSuccessfullTest() { var aggregate = new EventAggregate(); using (var tran = aggregate.BeginTransaction()) { aggregate.Push(0, "test"); tran.Commit(); } object result; Assert.IsTrue(aggregate.TryGetNext(0, out result)); Assert.AreEqual("test", result); }