public void AddRangeMetCheckOpAlBestaandeCombinatieCursusInstantie() { using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { repo.InsertRange(new List <CursusInstantie>() { new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), }, new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), }, }); } using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { var result = repo.FindAll(); Assert.AreEqual(1, repo.Count()); } }
public void AddRangeCursusInstantie() { int numberOfSavedChanges = 0; using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { numberOfSavedChanges = repo.InsertRange(new List <CursusInstantie>() { new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), }, new CursusInstantie() { CursusId = "C2", StartDatum = new DateTime(2016, 11, 15), }, }); } using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { var result = repo.FindAll(); Assert.AreEqual(2, repo.Count()); Assert.AreEqual(2, numberOfSavedChanges); } }
public void AddCursusInstantie() { using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { repo.Insert(new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), Cursus = new Cursus() { Code = "C1", Dagen = 3, Titel = "Cursus1" } }); } using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { var result = repo.Find(1); Assert.AreEqual(1, repo.Count()); Assert.AreEqual("C1", result.CursusId); Assert.AreEqual(new DateTime(2016, 10, 15), result.StartDatum); } }
public void AddRangeMetCheckOpNietBestaandeCursusEnAutomatischToevoegenCursusInstantie() { using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { repo.InsertRange(new List <CursusInstantie>() { new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), Cursus = new Cursus() { Code = "C1", Dagen = 2, Titel = "Cursus 1" }, }, new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 11, 15), Cursus = new Cursus() { Code = "C1", Dagen = 2, Titel = "Cursus 1" }, }, }); } using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { var result = repo.FindAll(); Assert.AreEqual(2, repo.Count()); } using (var repo = new CursusRepository(new DatabaseContext(_options))) { var result = repo.Find("C1"); Assert.AreEqual(1, repo.Count()); Assert.AreEqual(2, result.Dagen); Assert.AreEqual("Cursus 1", result.Titel); Assert.AreEqual("C1", result.Code); } }
public void TestFindAllCursusInstantie() { using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { repo.Insert(new CursusInstantie() { CursusId = "C1", StartDatum = new DateTime(2016, 10, 15), }); repo.Insert(new CursusInstantie() { CursusId = "C2", StartDatum = new DateTime(2016, 10, 15), }); } using (var repo = new CursusInstantieRepository(new DatabaseContext(_options))) { Assert.AreEqual(2, repo.Count()); } }