public async void ItShouldRemoveALocation() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); Location newLocation = new Location { Name = "location" }; //When await locationRepo.Add(newLocation); Location tempLocation = (await locationRepo.GetAll()).ElementAt(0); await locationRepo.Delete(tempLocation.ID); //Then Assert.Equal(0, (await locationRepo.GetAll()).Count()); }
public async void ItShouldUpdateALocation() { //Given EFCoreLocationRepository locationRepo = new EFCoreLocationRepository(ctx); Location newLocation = new Location { Name = "location" }; //When await locationRepo.Add(newLocation); Location tempLocation = (await locationRepo.GetAll()).ElementAt(0); tempLocation.Name = "otherLocation"; await locationRepo.Update(tempLocation); //Then Location actualLocation = (await locationRepo.GetAll()).ElementAt(0); Assert.Equal("otherLocation", actualLocation.Name); }
/// <summary> /// Presents a list of all known locations to the user /// </summary> public async Task <IActionResult> Index() { List <Location> locations = await locationRepo.GetAll(); return(View(locations)); }