Exemplo n.º 1
0
        public void GetAll_CitiesExist_ReturnCitiesDTO()
        {
            //Arrange
            int    nbOfCities = 4;
            var    cities     = CityFaker.Generate(nbOfCities);
            string name       = "";
            var    citiesDTO  = ToDTO.ToCitiesDto(cities);

            MockCityRepository.GetCities().Returns(cities);

            //Action
            var result = CityController.GetCities(name);


            // Assert
            result.Should().BeOfType <ObjectResult>()
            .Which.Value.ShouldBeEquivalentTo(citiesDTO);
        }
Exemplo n.º 2
0
        public void GetAll_ForASpecificCity_ReturnTheCityDTO()
        {
            //Arrange
            int nbOfCities = 4;
            var cities     = CityFaker.Generate(nbOfCities);

            cities[0].Name = "Paris";
            string name      = cities[0].Name;
            var    citiesDTO = ToDTO.ToCitiesDto(cities);

            MockCityRepository.GetCities().Returns(cities);

            //Action
            var result = CityController.GetCities(name);


            // Assert
            result.Should().BeOfType <ObjectResult>();
            citiesDTO[0].Name.ShouldBeEquivalentTo(name);
        }