コード例 #1
0
        public void CanSaveState()
        {
            var originator = new Originator(15);
            var memento = originator.SaveState();

            Assert.AreEqual(15, memento.State);

            originator = new Originator(256);
            originator.SetState(memento);

            Assert.AreEqual(15, originator.State);
        }
コード例 #2
0
 public void PushState(Originator originator)
 {
     var memento = originator.SaveState();
     this.stack.Push(memento);
 }