예제 #1
0
        public void ShouldDetectValidMoves()
        {
            BoardPosition position = new BoardPosition(new int[] { 1, 1, 2, 20, 20, 21 }, new int[] { 20, 20, 21, 1, 1, 2 });

            Assert.IsTrue(position.CanMove(1, 1));
            Assert.IsTrue(position.CanMove(2, 1));
            Assert.IsFalse(position.CanMove(1, 4));
            Assert.IsTrue(position.CanMove(1, 3));

            Assert.IsTrue(position.CanMove(20, 1));
            Assert.IsTrue(position.CanMove(21, 1));
            Assert.IsFalse(position.CanMove(20, 4));
            Assert.IsTrue(position.CanMove(20, 3));
            Assert.IsTrue(position.CanMove(20, 6));
            Assert.IsFalse(position.CanMove(24, 1));

            position.Color = Color.Red;

            Assert.IsTrue(position.CanMove(1, 1));
            Assert.IsTrue(position.CanMove(2, 1));
            Assert.IsFalse(position.CanMove(1, 4));
            Assert.IsTrue(position.CanMove(1, 3));

            Assert.IsTrue(position.CanMove(20, 1));
            Assert.IsTrue(position.CanMove(21, 1));
            Assert.IsFalse(position.CanMove(20, 4));
            Assert.IsTrue(position.CanMove(20, 3));
            Assert.IsTrue(position.CanMove(20, 6));
            Assert.IsFalse(position.CanMove(24, 1));
        }