public void cant_enqueue_in_nonexistant_transaction() { var sut = new TransactionManager(); Action actual = () => sut.Enqueue("abd", delegate { }, () => { }); actual.ShouldThrow<InvalidOperationException>(); }
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 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(); }