Пример #1
0
        public void TestFindAll()
        {
            using (var repo = new PenRepository(_options))
            {
                Pen pen = new Pen()
                {
                    Color = "Green",
                    Type  = "Marker"
                };
                repo.Insert(pen);
                pen = new Pen()
                {
                    Color = "Blue",
                    Type  = "Non marker"
                };
                repo.Insert(pen);
            }

            using (var repo = new PenRepository(_options))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }
Пример #2
0
        public void TestAdd()
        {
            using (var repo = new PenRepository(_options))
            {
                repo.Insert(new Pen()
                {
                    Color = "Green",
                    Type  = "Marker"
                });
            }


            using (var repo = new PenRepository(_options))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Пример #3
0
        public void TestDelete()
        {
            using (var repo = new PenRepository(_options))
            {
                Pen pen = new Pen()
                {
                    Color = "Green",
                    Type  = "Marker"
                };
                repo.Insert(pen);
                repo.Delete(1);
            }

            using (var repo = new PenRepository(_options))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }
Пример #4
0
        public void TestFind()
        {
            using (var repo = new PenRepository(_options))
            {
                repo.Insert(new Pen()
                {
                    Color = "Green",
                    Type  = "Marker"
                });
            }

            using (var repo = new PenRepository(_options))
            {
                var result = repo.Find(1);
                Assert.AreEqual(1, result.Id);
                Assert.AreEqual("Green", result.Color);
                Assert.AreEqual("Marker", result.Type);
            }
        }