Beispiel #1
0
        public async Task AddEvolution_Should_Return_200_Status_Code_With_Valid_ViewModel()
        {
            // Arrange
            var rnd = new Random();
            var id  = rnd.Next(1, 151);

            var data = new EvolutionViewModel()
            {
                pokemonId          = id,
                pokemonEvolutionId = id + 1
            };

            var result = BogusViewModel.PokemonViewModelFaker();

            result.Abilities = null;
            result.Stats     = null;

            pokemonServices.Setup(x => x.AddPokemonEvolution(data)).ReturnsAsync(
                result
                );

            var pokemonController = new PokemonController(pokemonServices.Object);

            // Act
            var response = await pokemonController.AddEvolution(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <OkObjectResult>(response.Result);
        }
Beispiel #2
0
        public async Task AddEvolution_Should_Return_400_Status_Code_If_Invalid_ViewModel(
            int pokemonId,
            int pokemonEvolutionId
            )
        {
            // Arrange
            var data = new EvolutionViewModel()
            {
                pokemonId          = pokemonId,
                pokemonEvolutionId = pokemonEvolutionId
            };

            var pokemonController = new PokemonController(pokemonServices.Object);

            // Act
            var response = await pokemonController.AddEvolution(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <BadRequestObjectResult>(response.Result);
        }