public void Do_Should_Do(IUnDoManager manager) { IUnDo undo = Substitute.For <IUnDo>(); bool done = false; undo.When(u => u.Do()).Do(_ => done = true); manager.Do(undo); Check.That(done).IsTrue(); }
public void IUnDoTransactionDispose_Should_undo_When_not_committed() { IUnDoManager manager = new UnDoManager(1); bool unDone = false; using (IUnDoTransaction transaction = manager.BeginTransaction()) { IUnDo undo = Substitute.For <IUnDo>(); undo.When(u => u.Undo()).Do(_ => unDone = true); manager.Do(undo); } Check.That(unDone).IsTrue(); }