public void Test_if_rolling_back_to_first_memento_works() { var m = new TokenMachine(); var m1 = m.AddToken(111); var m2 = m.AddToken(222); var m3 = m.AddToken(333); m.Revert(m1); Assert.AreEqual(111, m.Tokens.Last().Value); }
public void Changing_the_value_of_the_first_token_should_be_reverted_when_rolling_back() { var m = new TokenMachine(); var t = new Token(111); var m1 = m.AddToken(t); var m2 = m.AddToken(222); var m3 = m.AddToken(333); t.Value = 444; Assert.AreEqual(444, t.Value); m.Revert(m1); Assert.AreEqual(111, m.Tokens.Last().Value); }