コード例 #1
0
        public void Human_Can_Not_Win_Game_Diagonally_With_Computer_Counter_Inbetween_Four_Connecting_Counters()
        {
            //Arrange
            Grid grid = new Grid(6, 7);
            GameService gameService = new GameService();

            //Act
            grid.Counters.SingleOrDefault(c => c.Column == 1 && c.Row == 1).PlayerType = PlayerType.Human;
            grid.Counters.SingleOrDefault(c => c.Column == 2 && c.Row == 2).PlayerType = PlayerType.Human;
            grid.Counters.SingleOrDefault(c => c.Column == 3 && c.Row == 3).PlayerType = PlayerType.Computer;
            grid.Counters.SingleOrDefault(c => c.Column == 4 && c.Row == 4).PlayerType = PlayerType.Human;

            gameService.Diagonal(grid);

            //Assert
            Assert.AreEqual(GameStatus.NoWinner, gameService.GameStatus);
        }
コード例 #2
0
        public void Human_Can_Win_Game_Diagonally_To_The_Left()
        {
            //Arrange
            Grid grid = new Grid(6, 7);
            GameService gameService = new GameService();

            //Act
            grid.Counters.SingleOrDefault(c => c.Column == 6 && c.Row == 1).PlayerType = PlayerType.Human;
            grid.Counters.SingleOrDefault(c => c.Column == 5 && c.Row == 2).PlayerType = PlayerType.Human;
            grid.Counters.SingleOrDefault(c => c.Column == 4 && c.Row == 3).PlayerType = PlayerType.Human;
            grid.Counters.SingleOrDefault(c => c.Column == 3 && c.Row == 4).PlayerType = PlayerType.Human;

            gameService.Diagonal(grid);

            //Assert
            Assert.AreEqual(GameStatus.HumanWon, gameService.GameStatus);
        }