Example #1
0
        public void Given_an_existing_id_When_DoesThisGameExist_is_called_Then_results_must_be_true()
        {
            // Arrange
            var DataDbLoader = new DataDbLoader(_client);

            //Act
            var response =
                _client.Get <bool>(
                    UrlGame.DoesThisGameExist,
                    new Dictionary <string, string>()
            {
                { "gameId", DataDbLoader.existingGameInformationsId }
            });


            // Assert
            Assert.True(response.Success, $"Erreur retournée par l'API : {response.Error}");
            Assert.True(response.Value);
        }
Example #2
0
        public void When_GetAllGamesInfos_is_Called_Then_results_must_be_valid()
        {
            //Arrange
            var DataDbLoader = new DataDbLoader(_client);


            //Act
            var response = _client.Get <GameInformationDto[]>(UrlGame.GetAllGamesInfos);


            // Assert
            Assert.True(response.Success, $"Erreur retournée par l'API : {response.Error}");
            Assert.NotNull(response.Value);
        }
        public void Given_a_not_existing_id_When_GetGameStateById_is_called_Then_an_error_message_is_Returned()
        {
            //Arrange
            var DataDbLoader         = new DataDbLoader(_client);
            var expectedErrorMessage =
                string.Format(GameInMemoryRepository.MESSAGE_IF_NOT_FOUND_ITEM, DataDbLoader.notFoundGameInformationsId);

            //Act
            var response =
                _client.Get <BoardDto>(
                    UrlGame.GetBoardById,
                    new Dictionary <string, string>()
            {
                { "gameId", DataDbLoader.notFoundGameInformationsId }
            });


            // Assert
            Assert.True(response.Failure);
            Assert.Equal <string>(expectedErrorMessage, response.Error);
        }