public void Insert_Repos_SomeReposCountReturned() { //arrange var testContext = CreateContextWithTestData(); var repo = new FakeGenericRepository(testContext); List <CarModels> list = new List <CarModels> { new CarModels { CarModelID = 4, ManufactorID = 5, Name = "Four" }, new CarModels { CarModelID = 5, ManufactorID = 6, Name = "Five" }, new CarModels { CarModelID = 6, ManufactorID = 7, Name = "Six" } }; var actualCount = repo.Get().Count(); //act repo.Insert(list); var expectedCount = repo.Get().Count(); var expected = repo.GetByParam(x => x.CarModelID == 6); //asert Assert.AreEqual(actualCount + 3, expectedCount); Assert.AreEqual(list[2].Name, expected.Name); }
public void Insert_Repo_RepoPlusOneReturned() { //arrange var testContext = CreateContextWithTestData(); var repo = new FakeGenericRepository(testContext); var model = new CarModels { Name = "four", CarModelID = 4, ManufactorID = 5 }; var actualCount = repo.Get().Count(); //act repo.Insert(model); var expectedCount = repo.Get().Count(); var expectedRecord = repo.GetByParam(x => x.CarModelID == 4); //asert Assert.AreEqual(actualCount + 1, expectedCount); Assert.AreEqual(expectedRecord.Name, model.Name); }