public void ShouldNotUpdateAdvertWithWrongId() { Advert a = new Advert() { Id = 12, FuelType = "Gasoline", FirstRegistration = new DateTime(2012, 10, 02), Title = "Golf Avant", IsNew = false, Mileage = 25000, Price = 12000 }; Assert.Throws <NotFoundException>(() => _advertRepository.Update(a)); }
public ActionResult Edit(int id, Advert advert) { try { advRepository.Update(advert); return(RedirectToAction("Index")); } catch { return(View(advert)); } }