public void TestDeleteCity() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); City city = new City { Name = "Paris", DistrictId = district.Id }; city.Id = _locationManager.AddCity(city); Assert.IsTrue(city.Id > 0); List <City> cities = _locationManager.GetCities(); Assert.AreEqual(1, cities.Count); _locationManager.DeleteCityById(city.Id); cities = _locationManager.GetCities(); Assert.AreEqual(0, cities.Count); }
public void TestUpdateCity() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); City city = new City { Name = "Paris", DistrictId = district.Id }; city.Id = _locationManager.AddCity(city); city.Name = "qsd"; _locationManager.UpdateCity(city); List <City> cities = _locationManager.GetCities(); Assert.AreEqual("qsd", cities[0].Name); }
public void AddDistrict() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); }
public void TestDeleteDistrict() { LocationsManager _locationManager = (LocationsManager)container["LocationsManager"]; Province province = new Province("France"); province.Id = _locationManager.AddProvince(province.Name); Assert.AreNotEqual(0, province.Id); District district = new District("Ile de France", province); district.Id = _locationManager.AddDistrict(district); Assert.AreNotEqual(0, district.Id); List <District> districts = _locationManager.GetDistricts(); Assert.AreEqual(3, districts.Count); _locationManager.DeleteDistrictById(district.Id); districts = _locationManager.GetDistricts(); Assert.AreEqual(2, districts.Count); }
public int AddDistrict(string name, int pProvinceId) { CheckLocation(name); return(_locationsManager.AddDistrict(name, pProvinceId)); }