public void TestUpdate() { using (RaceContext context = new RaceContext()) { using (CarCRUD CarCRUD = new CarCRUD(new RaceContext())) { var car = new Cars { Name = "Update" }; CarCRUD.Update(car); Assert.NotNull(context.Cars.Where(a => a.Name.Contains("Update")).FirstOrDefault()); } } }
public void Update_given_car_updates_car() { var cc = new CarCRUD(context); var car = new Car { Name = "Car Three", DriverName = "Driver Three" }; cc.Create(car); car.Name = "Super Awesome Car"; cc.Update(car); var expected = "Super Awesome Car"; var actual = car.Name; Assert.Equal(expected, actual); context.Remove(car); context.SaveChanges(); }