public void Unit_State_PickCard_Twice()
        {
            // 1: blue, green, white | 2: red, yellow
            var startingPositions = TestHelper.ConvertToStartingPositions("1,0 1,1 1,2 2,3 2,4");
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);

            gamestate.Apply(new PickCardStateChange(0, CamelColor.Blue, 5));
            gamestate.Apply(new PickCardStateChange(0, CamelColor.Blue, 3));

            var c5 = gamestate.BettingCards.First(x => x.Value == 5 && x.CamelColor == CamelColor.Blue).Owner;
            var c3 = gamestate.BettingCards.First(x => x.Value == 3 && x.CamelColor == CamelColor.Blue).Owner;
            var c2 = gamestate.BettingCards.First(x => x.Value == 2 && x.CamelColor == CamelColor.Blue).Owner;

            Assert.AreEqual(0, c5, "blue 5 owner");
            Assert.AreEqual(0, c3, "blue 3 owner");
            Assert.AreEqual(-1, c2, "blue 2 owner");
        }
Пример #2
0
        public void Unit_RevertState_DiceThrow()
        {
            // 1: blue, green, white | 2: red, yellow
            var startString       = "1,0 1,1 1,2 2,3 2,4";
            var startingPositions = TestHelper.ConvertToStartingPositions(startString);
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);
            var change            = new DiceThrowStateChange(0, CamelColor.Blue, 1);

            // 2: red, yellow, blue, green, white
            gamestate.Apply(change).Revert(change);

            AssertBaseState(gamestate, startString);
        }
        public void Unit_State_DiceThrow()
        {
            // 1: blue, green, white | 2: red, yellow
            var startingPositions = TestHelper.ConvertToStartingPositions("1,0 1,1 1,2 2,3 2,4");
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);
            var change            = new DiceThrowStateChange(0, CamelColor.Blue, 1);

            // 2: red, yellow, blue, green, white
            gamestate.Apply(change);

            Assert.AreEqual("2,2 2,3 2,4 2,0 2,1", gamestate.CamelPositionToString(), "Camel positions");

            Assert.AreEqual(4, gamestate.Money[0], "money");
        }
Пример #4
0
        public void Unit_RevertState_DiceThrow_Trap4()
        {
            // 1: blue, green, white | trap | 3: red, yellow
            var startString       = "1,0 1,1 1,2 3,3 3,4";
            var startingPositions = TestHelper.ConvertToStartingPositions(startString);
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);

            gamestate.Traps[1].Location = 2;
            gamestate.Traps[1].Move     = -1;
            var change = new DiceThrowStateChange(0, CamelColor.Green, 1);

            // 1: green, white, BLUE | trap | 3: red, yellow
            gamestate.Apply(change).Revert(change);

            AssertBaseState(gamestate, startString);
        }
        public void Unit_State_PickCard()
        {
            // 1: blue, green, white | 2: red, yellow
            var startingPositions = TestHelper.ConvertToStartingPositions("1,0 1,1 1,2 2,3 2,4");
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);
            var change            = new PickCardStateChange(0, CamelColor.Blue, 5);

            gamestate.Apply(change);

            var owner = gamestate.BettingCards.Where(x => x.Value == 5).ToDictionary(x => x.CamelColor, x => x.Owner);

            Assert.AreEqual(0, owner[CamelColor.Blue], "blue 5 owner");
            Assert.AreEqual(-1, owner[CamelColor.Green], "green 5 owner");
            Assert.AreEqual(-1, owner[CamelColor.White], "white 5 owner");
            Assert.AreEqual(-1, owner[CamelColor.Red], "red 5 owner");
            Assert.AreEqual(-1, owner[CamelColor.Yellow], "yellow 5 owner");
        }
        public void Unit_State_DiceThrow_Trap3()
        {
            // 1: blue, green, white | trap | 3: red, yellow
            var startingPositions = TestHelper.ConvertToStartingPositions("1,0 1,1 1,2 3,3 3,4");
            var gamestate         = new ImplementedGameState(2, startingPositions, 16, 3);

            gamestate.Traps[0].Location = 2;
            gamestate.Traps[0].Move     = -1;
            var change = new DiceThrowStateChange(0, CamelColor.Green, 1);

            // 1: green, white, BLUE | trap | 3: red, yellow
            gamestate.Apply(change);

            Assert.AreEqual("1,2 1,0 1,1 3,3 3,4", gamestate.CamelPositionToString(), "Camel positions");

            Assert.AreEqual(5, gamestate.Money[0], "money");
        }