Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }