Esempio n. 1
0
        public void TestUpdate()
        {
            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                repo.Insert(new Room()
                {
                    Name = "Naam"
                });
            }

            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                repo.Update(new Room()
                {
                    Id   = 1,
                    Name = "UpdatedName"
                });
            }

            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
                Assert.AreEqual("UpdatedName", repo.Find(1).Name);
            }
        }
Esempio n. 2
0
        public void TestAdd()
        {
            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                repo.Insert(new Room()
                {
                    Name = "Naam"
                });
            }


            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Esempio n. 3
0
        public void TestDelete()
        {
            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                var pen = new Room()
                {
                    Name = "Name"
                };
                repo.Insert(pen);
                repo.Delete(1);
            }

            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }
Esempio n. 4
0
        public void TestFindAll()
        {
            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                var pen = new Room()
                {
                    Name = "Entity"
                };
                repo.Insert(pen);
                pen = new Room()
                {
                    Name = "Name"
                };
                repo.Insert(pen);
            }

            using (var repo = new RoomRepository(new GamesBackendContext(_options)))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }