示例#1
0
        public void CaptureMovementCompleted()
        {
            //Arrange
            Initilizer initilizer             = new Initilizer();
            Dictionary <Square, Player> board = initilizer.InitEmptyBoard();

            board[new Square(1, 2)] = Player.White;
            board[new Square(2, 3)] = Player.Black;

            int countBlacksBefore = board.Count(a => a.Value == Player.Black);

            Assert.IsTrue(countBlacksBefore == 1);

            Square from = new Square(1, 2);
            Square to   = new Square(3, 4);

            Game game = new Game(board);

            //Act:
            game.Move(Player.White, from, to);
            Assert.IsTrue(board[from] == Player.None);
            Assert.IsTrue(board[to] == Player.White);

            Square between = new Square((from.X + to.X) / 2, (from.Y + to.Y) / 2);

            Assert.IsTrue(board[between] == Player.None);
            int countBlacks = board.Count(a => a.Value == Player.Black);

            Assert.IsTrue(countBlacks == 0);
        }
示例#2
0
        public void MovementToOccupiedSquare()
        {
            //Arrange
            Initilizer initilizer             = new Initilizer();
            Dictionary <Square, Player> board = initilizer.InitEmptyBoard();

            board[new Square(3, 4)] = Player.Black;
            Square from      = new Square(4, 3);
            Square to        = new Square(3, 4);
            Game   validator = new Game(board);
            //Act:
            bool result = validator.ValidateFeasibility(from, to);

            Assert.IsFalse(result);
        }
示例#3
0
        public void TotalPayableAmountTest()
        {
            Initilizer I = new Initilizer();

            I.PopulateProductItems();
            I.BuildChart();

            ChartBuilder           cb   = new ChartBuilder(I.PopulateProductItems(), I.BuildChart());
            List <CheckoutDetails> list = cb.FormCheckoutPage();


            Program.calculateTotalAmount(list);

            Assert.AreEqual(Program.calculateTotalAmount(list), 48);
        }
示例#4
0
        public void NormalMovementCompleted()
        {
            //Arrange
            Initilizer initilizer             = new Initilizer();
            Dictionary <Square, Player> board = initilizer.InitEmptyBoard();

            board[new Square(1, 2)] = Player.White;
            Square from = new Square(1, 2);
            Square to   = new Square(2, 3);

            Game game = new Game(board);

            //Act:
            game.Move(Player.White, from, to);
            Assert.IsTrue(board[from] == Player.None);
            Assert.IsTrue(board[to] == Player.White);
        }
示例#5
0
        private void Init()
        {
            Initilizer.InitData();

            NavigationService.Navigate(new Uri(OkrConstant.HOMEVIEW, UriKind.Relative));
        }