Пример #1
0
        public void TestClear()
        {
            var manaPool = new ManaPool ();

            manaPool.Add (COLOR.Red, 2);
            manaPool.Add (COLOR.Green, 2);
            manaPool.Add (COLOR.Blue, 3);

            manaPool.Clear ();
            foreach (var color in EnumUtil.GetValues<COLOR>()) {
                Assert.AreEqual (0, manaPool [color]);
            }
        }
Пример #2
0
        public void TestAdd()
        {
            var manaPool = new ManaPool ();

            manaPool.Add (COLOR.Red, 2);
            manaPool.Add (COLOR.Red, 2);
            manaPool.Add (COLOR.Blue, 3);
            foreach (var color in EnumUtil.GetValues<COLOR>()) {
                switch (color) {
                case COLOR.Red:
                    Assert.AreEqual (4, manaPool [color]);
                    break;
                case COLOR.Blue:
                    Assert.AreEqual (3, manaPool [color]);
                    break;
                default:
                    Assert.AreEqual (0, manaPool [color]);
                    break;
                }
            }
        }
Пример #3
0
        public void TestRemove()
        {
            var manaPool = new ManaPool ();

            manaPool.Add (COLOR.Red, 2);
            manaPool.Add (COLOR.Green, 2);
            manaPool.Add (COLOR.Blue, 3);

            Assert.IsTrue (manaPool.Remove (COLOR.Red, 1));
            Assert.IsFalse (manaPool.Remove (COLOR.Red, 2));
            Assert.AreEqual (1, manaPool [COLOR.Red]);

            Assert.IsFalse (manaPool.Remove (COLOR.White, 1));
            Assert.IsFalse (manaPool.Remove (COLOR.Blue, 4));
        }
Пример #4
0
        public void TestInvalidAdd()
        {
            var manaPool = new ManaPool ();

            manaPool.Add (COLOR.Black, -1);
        }