示例#1
0
        public void AddPointOfInterestForCity_CityExist_ReturnsCreatedAtRouteResult()
        {
            //Arrange
            var anyCity = CityFaker.Generate();
            var anyPoi  = new PointOfInterest()
            {
                Name         = "Château Frontenac",
                Descritption = "Emblème de la ville",
                Latitude     = "46° 48\' 25.79\" N",
                Longitude    = " -71° 12\' 10.80\" W"
            };

            var poiDTO = new PoiDTO()
            {
                Name         = anyPoi.Name,
                Descritption = anyPoi.Descritption,
                Latitude     = anyPoi.Latitude,
                Longitude    = anyPoi.Longitude
            };

            MockCityRepository.CityExists(anyCity.Id).Returns(true);

            //Action
            var result = CityController.AddPointOfInterestForCity(anyCity.Id, poiDTO);


            // Assert
            result.Should().BeOfType <CreatedAtRouteResult>();
        }
示例#2
0
        public void AddPointOfInterest_InvalidPoiData_ReturnBadRequest()
        {
            CityController.ModelState.AddModelError("Error", "Model State Error");

            var city = CityFaker.Generate();

            MockCityRepository.CityExists(city.Id).Returns(true);
            var result = CityController.AddPointOfInterestForCity(city.Id, new PoiDTO());

            result.Should().BeOfType <BadRequestObjectResult>();
        }
示例#3
0
        public void AddPointOfInterestForCity_PoiIsNull_ReturnsBadRequestResult()
        {
            //Arrange
            var anyCity = CityFaker.Generate();

            MockCityRepository.CityExists(anyCity.Id).Returns(true);
            MockCityRepository.AddPointOfInterestForCity(anyCity.Id, null);

            //Action
            var result = CityController.AddPointOfInterestForCity(anyCity.Id, null);


            // Assert
            result.Should().BeOfType <BadRequestResult>();
        }