Beispiel #1
0
        public void TestFindAllCursuses()
        {
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                var cursus = new Cursus()
                {
                    Titel = "Cursus1",
                    Code  = "C1",
                    Dagen = 3,
                };
                repo.Insert(cursus);
                cursus = new Cursus()
                {
                    Titel = "Cursus2",
                    Code  = "C2",
                    Dagen = 3,
                };
                repo.Insert(cursus);
            }

            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }
        public void TestCount()
        {
            // Arrange
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                // Act
                repo.Insert(new Cursus()
                {
                    Id         = 1,
                    CursusCode = "Naam"
                });
                repo.Insert(new Cursus()
                {
                    Id         = 2,
                    CursusCode = "Andere naam"
                });
                repo.Insert(new Cursus()
                {
                    Id         = 3,
                    CursusCode = "Nieuwere naam"
                });
                repo.Insert(new Cursus()
                {
                    Id         = 4,
                    CursusCode = "Laatste naam"
                });
            }

            // Assert
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(4, repo.Count());
            }
        }
Beispiel #3
0
        public void TestAdd()
        {
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                //Arrange
                var cursus = new Cursus()
                {
                    Cursuscode = "test",
                    Duur       = 5,
                    Titel      = "Name"
                };
                var cursusInstantie = new CursusInstantie()
                {
                    Startdatum = new DateTime(2016, 10, 10),
                    Cursus     = cursus
                };
                //Act
                repo.Insert(cursusInstantie);
            }


            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
        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);
            }
        }
Beispiel #5
0
        public void TestAddCursus()
        {
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                repo.Insert(new Cursus()
                {
                    Titel = "Cursus1",
                    Code  = "C1",
                    Dagen = 3,
                });
            }

            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
        public void TestAdd()
        {
            // Arrange
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                // Act
                repo.Insert(new Cursus()
                {
                    Id         = 1,
                    CursusCode = "Naam"
                });
            }

            // Assert
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Beispiel #7
0
        public void TestDeleteCursus()
        {
            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                var pen = new Inschrijving()
                {
                    Titel = "Cursus1",
                    Code  = "C1",
                    Dagen = 3,
                };
                repo.Insert(pen);
                repo.Delete("C1");
            }

            using (var repo = new CursusRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }