Example #1
0
        public void TestFindAll()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                var klant = new Klant()
                {
                    Voorletters = "YP"
                };
                repo.Insert(klant);
                klant = new Klant()
                {
                    Voorletters = "YPK"
                };
                repo.Insert(klant);
            }

            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }
Example #2
0
        public void TestFindAll()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Klant klant = new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                };
                repo.Insert(klant);
                klant = new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink2"
                };
                repo.Insert(klant);
            }

            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }
Example #3
0
        public void TestAdd()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "YP"
                });
            }


            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Example #4
0
        public void TestAdd()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                });
            }


            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Example #5
0
        public void TestDelete()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                var pen = new Klant()
                {
                    Voorletters = "YP"
                };
                repo.Insert(pen);
                repo.Delete(1);
            }

            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }
Example #6
0
        public void TestFind()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                });
            }

            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                var result = repo.Find(1);
                Assert.AreEqual(1, result.Id);
                Assert.AreEqual("Keemink", result.Achternaam);
                Assert.AreEqual("Y.P", result.Voorletters);
            }
        }
        public void Repository_InsertsKlant()
        {
            // Arrange
            var         options = CreateNewContextOptions();
            IRepository target  = new KlantRepository(options);

            var klant = new Klant()
            {
            };

            // Act
            target.Insert(klant);

            // Assert
            using (var context = new KlantContext(options))
            {
                Assert.AreEqual(1, context.Klanten.Count());
            }
        }