public void GetCity_ItemDoesntExistAndPOIisNotRequested_ReturnNotFoundResult() { var result = CityPoiController.GetCity(BadId, false); result.Should().BeOfType <NotFoundResult>(); }
public BaseCityControllerTest() { FakeCityRepository = Substitute.For <ICityRepository>(); CityPoiController = new CityPoiController(FakeCityRepository); PoiController = new PoiController(FakeCityRepository); CityPoiItemBuilder = new CityPoiItemBuilder(); DtoMapper = new DtoMapper(); }
public void GetCity_ItemExistAndPOIisNotRequested_ReturnCityWithNoPOIDTO() { var city = CityPoiItemBuilder.GenerateCity(); var cityDto = new CityWithNoPoidto { CityId = city.Id, Name = city.Name, Country = city.Country, Population = city.Population }; FakeCityRepository.GetCity(city.Id, false).Returns(city); var result = CityPoiController.GetCity(city.Id, false); result.Should().BeOfType <ObjectResult>().Which.Value.ShouldBeEquivalentTo(cityDto); }
public void GetCities_CititesExist_ReturnCityDtos() { //Arrange const int listLength = 10; var cities = CityPoiItemBuilder.GenerateCityList(listLength); var dtoList = cities.Select(city => new CityWithNoPoidto { CityId = city.Id, Name = city.Name, Country = city.Country, Population = city.Population }).ToList(); FakeCityRepository.GetCities().Returns(cities); //Action var result = CityPoiController.GetAll(); // Assert result.ShouldBeEquivalentTo(dtoList); }