コード例 #1
0
        public void AddCity_When_city_Then_added_city()
        {
            // Arrange
            CityName city1 = new CityName
            {
                Name = "City1"
            };

            // Act
            _weatherService.AddCity(city1);

            // Assert
            using (var db = new WeatherContext())
            {
                Assert.IsNotNull(db.Cities.Where(c => c.Name == city1.Name).FirstOrDefault());
            }
        }
コード例 #2
0
 public IActionResult AddCity(int id)
 {
     service.AddCity(id);
     return(Ok());
 }