Пример #1
0
        public void Board_Play_TwiceError()
        {
            // ARRANGE
            var gameServiceMock = new Mock <ITwgeService>();
            var gameBoard       = new BoardContext(gameServiceMock.Object);

            gameBoard.Initialize();
            var cellCoordinate = new Coordinate('a', 1);

            gameBoard.Play(cellCoordinate, Cell.Marker.Circle);

            // ACT
            Action act = () => gameBoard.Play(cellCoordinate, Cell.Marker.Cross);

            // ASSERT
            Assert.Throws <InvalidOperationException>(act);
            var cell = gameBoard.Matrix[cellCoordinate];

            Assert.Equal(Cell.Marker.Circle, cell.Mark);
        }
Пример #2
0
        public void Board_InvalidStates_Blanco()
        {
            //// ARRANGE
            var gameServiceMock = new Mock <ITwgeService>();
            var gameBoard       = new BoardContext(gameServiceMock.Object);

            // ACT / ASSERT
            var cellCoordinate = new Coordinate('a', 1);

            Assert.Throws <InvalidOperationException>(() => gameBoard.Play(cellCoordinate, Cell.Marker.Circle));
            Assert.Throws <InvalidOperationException>(() => gameBoard.End());
        }
Пример #3
0
        public void PlayBoard_Success()
        {
            // ARRANGE
            var gameServiceMock = new Mock <ITwgeService>();
            var gameBoard       = new BoardContext(gameServiceMock.Object);

            gameBoard.Initialize();

            // ACT
            var cellCoordinate = new Coordinate('a', 1);

            gameBoard.Play(cellCoordinate, Cell.Marker.Circle);

            // ASSERT
            var cell = gameBoard.Matrix[cellCoordinate];

            Assert.Equal(Cell.Marker.Circle, cell.Mark);
        }