public void Update_Repo_OneRepoPlusReturned() { FakeGoodwillEntitesContext testContext = CreateContextWithTestData(); var repo = new FakeGenericRepository(testContext); //arrange var car = repo.GetByParam(x => x.CarModelID == 1); string fakeName = "Alfasud1"; //act car.Name = fakeName; repo.Update(car); testContext.SaveChanges(); var newCar = repo.GetByParam(x => x.CarModelID == 1); //asert Assert.AreEqual(fakeName, newCar.Name); }
public void Update_Repos_SomeReposCountReturned() { //arrange var testContext = CreateContextWithTestData(); var repo = new FakeGenericRepository(testContext); string expectedName = "change"; var car = repo.Get(x => x.CarModelID >= 2); foreach (var c in car) { c.Name = expectedName; } //act repo.Update(car); testContext.SaveChanges(); var newCar = repo.Get(x => x.CarModelID >= 2); //asert Assert.AreNotEqual(car, newCar); }