示例#1
0
        public void TestSingleToken()
        {
            var tm = new TokenMachine();
            var m  = tm.AddToken(123);

            tm.AddToken(456);
            tm.Revert(m);

            Assert.That(tm.Tokens.Count, Is.EqualTo(1));
            Assert.That(tm.Tokens[0].Value, Is.EqualTo(123));
        }
示例#2
0
        public void TestTwoTokens()
        {
            var tm = new TokenMachine();

            tm.AddToken(1);
            var m = tm.AddToken(2);

            tm.AddToken(3);
            tm.Revert(m);

            Assert.That(tm.Tokens.Count, Is.EqualTo(2));
            Assert.That(tm.Tokens[0].Value, Is.EqualTo(1));
            Assert.That(tm.Tokens[1].Value, Is.EqualTo(2));
        }
示例#3
0
        public void TestFiddledToken()
        {
            var tm    = new TokenMachine();
            var token = new Token(111);

            tm.AddToken(token);
            var m = tm.AddToken(222);

            token.Value = 333;
            Assert.That(tm.Tokens[0].Value, Is.EqualTo(333));

            tm.Revert(m);

            Assert.That(tm.Tokens.Count, Is.EqualTo(2));
            Assert.That(tm.Tokens[0].Value, Is.EqualTo(111));
        }