Exemple #1
0
        public void CursistInsert2ThenGetAllCount2()
        {
            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                //Arrange
                Cursist cursist = new Cursist()
                {
                    Voornaam          = "Kees",
                    Achternaam        = "Koning",
                    CursusInstantieID = 1
                };
                Cursist cursist2 = new Cursist()
                {
                    Voornaam          = "Marco",
                    Achternaam        = "Pil",
                    CursusInstantieID = 2
                };
                //Act
                repo.Insert(cursist);
                repo.Insert(cursist2);

                var result = repo.FindAll();
                //Assert
                Assert.IsInstanceOfType(result, typeof(IEnumerable <Cursist>));
                Assert.AreEqual(2, result.Count());
            }
        }
Exemple #2
0
        public void CursistInsertDeleteThenGetAllCount0()
        {
            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                //Arrange
                var cursus = new Cursus()
                {
                    Cursuscode = "test",
                    Duur       = 5,
                    Titel      = "C# testing"
                };
                var cursusInstantie = new CursusInstantie()
                {
                    Startdatum = new DateTime(2016, 10, 15),
                    Cursus     = cursus
                };

                Cursist cursist = new Cursist()
                {
                    Voornaam          = "Kees",
                    Achternaam        = "Koning",
                    CursusInstantieID = 1
                };
                //Act
                repo.Insert(cursist);
                repo.Delete(1);
                var result = repo.FindAll();
                //Assert
                Assert.IsInstanceOfType(result, typeof(IEnumerable <Cursist>));
                Assert.AreEqual(0, result.Count());
            }
        }
Exemple #3
0
        public void CursistGetAll()
        {
            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                //Arrange

                //Act
                var result = repo.FindAll();
                //Assert
                Assert.IsInstanceOfType(result, typeof(IEnumerable <Cursist>));
            }
        }
Exemple #4
0
 public void CursistInsertThenGetAll()
 {
     using (var repo = new CursistRepository(new DatabaseContext(_options)))
     {
         //Arrange
         Cursist cursist = new Cursist();
         //Act
         repo.Insert(cursist);
         var result = repo.FindAll();
         //Assert
         Assert.IsInstanceOfType(result, typeof(IEnumerable <Cursist>));
         Assert.AreEqual(1, result.Count());
     }
 }
Exemple #5
0
        public void TestAddCursist()
        {
            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                repo.Insert(new Cursist()
                {
                    Achternaam = "Keemink",
                    Voornaam   = "Yael"
                });
            }

            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Exemple #6
0
        public void TestFindCursus()
        {
            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                repo.Insert(new Cursist()
                {
                    Achternaam = "Keemink",
                    Voornaam   = "Yael"
                });
            }


            using (var repo = new CursistRepository(new DatabaseContext(_options)))
            {
                var result = repo.Find(1);
                Assert.AreEqual(1, result.Id);
                Assert.AreEqual("Keemink", result.Achternaam);
                Assert.AreEqual("Yael", result.Voornaam);
            }
        }