public async Task Should_Return_201_Status_Code_If_Pokemon_Created()
        {
            // Arrange
            var client = factory.CreateClient();
            await factory.AuthenticateAsync(client);

            var data = BogusViewModel.PokemonViewModelFaker();

            // Act
            var response = await PerformRequest(client, data);

            var pokemonViewModel = JsonConvert.DeserializeObject <PokemonViewModel>(
                await response.Content.ReadAsStringAsync()
                );

            // Assert
            Assert.Equal(HttpStatusCode.Created, response.StatusCode);

            File.Delete(
                Path.Combine(
                    Directory.GetCurrentDirectory(),
                    "..",
                    "..",
                    "..",
                    "..",
                    "PokeAPI",
                    "wwwroot",
                    "images",
                    pokemonViewModel.PhotoUrl
                    )
                );
        }
Esempio n. 2
0
        public async Task Should_Return_201_Status_Code_If_Ability_Created()
        {
            // Arrange
            var client = factory.CreateClient();
            await factory.AuthenticateAsync(client);

            var data = BogusViewModel.AbilityViewModelFaker();

            data.Id = 3;

            // Act
            var response = await PerformRequest(client, data);

            // Assert
            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
        }
Esempio n. 3
0
        public async Task Should_Return_200_Status_Code_If_Pre_Evolution_Added()
        {
            // Arrange
            var client = factory.CreateClient();
            await factory.AuthenticateAsync(client);

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

            // Act
            var response = await PerformRequest(client, data);

            // Assert
            Assert.NotNull(response);
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }