Пример #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);
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }