コード例 #1
0
        public void GetForecast_WhenCalled_ReturnsOkAndCityForecastDTO()
        {
            // Arrange
            this._externalServiceMock.Setup(svc => svc.GetCityForecast(It.IsAny <string>()))
            .Returns(new CityForecastDTO());
            CitiesController controller = this.GenerateCitiesController();

            // Act
            var okResult = controller.GetForecast("x12345");

            // Assert
            Assert.IsType <OkObjectResult>(okResult.Result);
            Assert.IsType <CityForecastDTO>((okResult.Result as OkObjectResult).Value);
        }