Example #1
0
        public void SaveCity_DeleteExistingCity_ShouldDeleteSuccessfully(string Name)
        {
            using (var scope = _iContainer.BeginLifetimeScope(AppContextType.UnitTest.ToString()))
            {
                _iCityDal = scope.Resolve <ICityDal>();

                var cityResult = _iCityDal.GetCityByName(Name);

                cityResult = _iCityDal.SaveCity(cityResult, true);

                Assert.True(cityResult == null);
            }
        }
Example #2
0
        public string SaveCity(string cityJson)
        {
            try
            {
                var city = JsonConvert.DeserializeObject <City>(cityJson);
                city = _iCityDal.SaveCity(city);

                return(JsonConvert.SerializeObject(city));
            }
            catch (Exception ex)
            {
                log.Error($"Exception in Method SaveCity for Json Data - {cityJson}", ex);
                throw;
            }
        }
Example #3
0
        public void SaveCity_SaveNewCity_ShouldSaveSuccessfully(int countryId, string Name)
        {
            using (var scope = _iContainer.BeginLifetimeScope(AppContextType.UnitTest.ToString()))
            {
                _iCityDal = scope.Resolve <ICityDal>();

                var city = new City {
                    CountryId = countryId, Name = Name
                };

                var cityList = _iCityDal.SaveCity(city);

                Assert.True(cityList != null);
            }
        }