public void TestUpdateAuto() { //Adding using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA-11-BB" }); } //Updating using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Update(new Auto() { Id = 1, Kenteken = "AA-11-CC" }); } //Checking using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var result = repo.Find(1); Assert.AreEqual(1, repo.Count()); Assert.AreEqual("AA-11-CC", result.Kenteken); } }
public void TestAdd() { using (var repo = new AutoRepository(new FrontEndContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA - 11 - BB" }); } using (var repo = new AutoRepository(new FrontEndContext(_options))) { Assert.AreEqual(1, repo.Count()); } }
public void TestDelete() { using (var repo = new AutoRepository(new FrontEndContext(_options))) { var auto = new Auto() { Kenteken = "AA - 11 - BB" }; repo.Insert(auto); repo.Delete(1); } using (var repo = new AutoRepository(new FrontEndContext(_options))) { Assert.AreEqual(0, repo.Count()); } }
public void TestAddAuto() { using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA-11-BB" }); } using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var result = repo.FindAll().Single(); Assert.AreEqual(1, repo.Count()); Assert.AreEqual("AA-11-BB", result.Kenteken); } }
public void TestFindAllAuto() { using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var auto = new Auto() { Kenteken = "AA-11-BB" }; repo.Insert(auto); auto = new Auto() { Kenteken = "AA-12-BB" }; repo.Insert(auto); } using (var repo = new AutoRepository(new AutosBackendContext(_options))) { Assert.AreEqual(2, repo.Count()); } }