示例#1
0
        public void Delete()
        {
            var dbContext = SetUpThreeCases("test-delete");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                var before = repository.FindAll();

                Assert.AreEqual(3, before.Count);

                repository.Delete("test docket number two");

                var after = repository.FindAll();

                Assert.AreEqual(2, after.Count);
            }
        }
示例#2
0
        public void FindAll()
        {
            var dbContext = SetUpThreeCases("test-find-all");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                var result = repository.FindAll();

                Assert.AreEqual(3, result.Count);
            }
        }
示例#3
0
        public void Save()
        {
            var dbContext = SetUpThreeCases("test-save");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                repository.Save(new Case
                {
                    Id           = "4",
                    DocketNumber = "test docket number four",
                    Title        = "test title four",
                    Description  = "test description four",
                    OpenDate     = DateTime.Now
                });

                var result = repository.FindAll();

                Assert.AreEqual(4, result.Count);
            }
        }