コード例 #1
0
        public void GetGameState_Action_Should_Return_Game_Object()
        {
            ActionResult <Guid> responseStart = _gameController.Start(new StartGameArguments
            {
                Player1 = "Carlos",
                Player2 = "Marta"
            });

            ActionResult <Game> response = _gameController.GetGameState(responseStart.Value);

            Assert.IsNotNull(response.Value);
            Assert.AreEqual(responseStart.Value, response.Value.Id);
        }
コード例 #2
0
        public async Task Move_Action_Should_Return_List_Of_Events()
        {
            GamesController gameController = new GamesController(GameServiceFactory.Create(), null);

            ActionResult <Guid> responseStart = gameController.Start(new StartGameArguments
            {
                Player1 = "Carlos",
                Player2 = "Marta"
            });

            Guid whitesPlayerId = gameController.GetGameState(responseStart.Value).Value.WhitesPlayer.Id;

            gameController = new GamesController(GameServiceFactory.Create(whitesPlayerId), null);

            ActionResult <TurnLog> response = await gameController.Move(responseStart.Value, new MoveArguments
            {
                Origin      = "C2",
                Destination = "C4"
            });

            Assert.IsNotNull(response.Value);
            Assert.AreNotEqual(0, response.Value.TurnEvents.Count);
        }