public void transaction_id_should_be_able_to_Be_reused_after_commit() { var sut = new TransactionManager(); sut.Begin("abc"); sut.Commit("abc"); sut.Begin("abc"); }
public void transaction_id_should_be_able_to_Be_reused_after_rollback() { var sut = new TransactionManager(); sut.Begin("abc"); sut.Rollback("abc"); sut.Begin("abc"); }
public void transaction_id_must_be_unique_for_Every_new_transaction() { var sut = new TransactionManager(); sut.Begin("abc"); Action actual = () => sut.Begin("abc"); actual.ShouldThrow<InvalidOperationException>(); }
public void pending_is_true_when_we_got_an_Active_transaction() { var sut = new TransactionManager(); sut.Begin("abc"); var actual = sut.HasActiveTransactions; actual.Should().BeTrue(); }
public void cleanup_cancels_all_transactions() { var firstIsRolledback = false; var secondIsRolledback = false; var sut = new TransactionManager(); sut.Begin("abd"); sut.Enqueue("abd", () => { }, delegate { firstIsRolledback = true; }); sut.Begin("abc"); sut.Enqueue("abc", () => { }, delegate { secondIsRolledback = true; }); sut.Cleanup(); firstIsRolledback.Should().BeTrue(); secondIsRolledback.Should().BeTrue(); }
public void can_commit_existing_transaction() { var sut = new TransactionManager(); sut.Begin("abd"); sut.Commit("abd"); }
public void commit_invokes_all_transaction_actions() { var first = false; var second = false; var sut = new TransactionManager(); sut.Begin("abd"); sut.Enqueue("abd", delegate { first = true; },() => { }); sut.Enqueue("abd", delegate { second = true; }, () => { }); sut.Commit("abd"); first.Should().BeTrue(); second.Should().BeTrue(); }