public async Task Get_All_Continents() { //Arrange cityQueries = new CityQueries(context.Object); //Act var cqCities = await cityQueries.GetAllCitiesAsync(); //Assert Assert.AreEqual(cities.Count, cqCities.Count); }
public async Task City_Not_Found() { //Arrange string cityName = "Muffin"; cityQueries = new CityQueries(context.Object); //Act var result = await cityQueries.GetCityAsync(cityName); //Assert Assert.IsNull(result); }
public async Task Get_City_By_Name() { //Arrange string cityName = "Pie"; cityQueries = new CityQueries(context.Object); //Act var result = await cityQueries.GetCityAsync(cityName); var state = cities.Where(w => w.Name == cityName).FirstOrDefault(); //Assert Assert.AreEqual(state.StateId, result.StateId); Assert.AreEqual(state.Name, result.Name); }
public async Task Get_State_By_Id() { //Arrange int cityId = 2; cityQueries = new CityQueries(context.Object); //Act var result = await cityQueries.GetCityAsync(cityId); var state = cities.Where(w => w.CityId == cityId).FirstOrDefault(); //Assert Assert.AreEqual(state.CityId, result.CityId); Assert.AreEqual(state.Name, result.Name); }
public CitiesController(DbContext context) { this.cq = new CityQueries(context); }