예제 #1
0
        public void ShouldBeDirtyWhenRecordsAdded()
        {
            var cat = new Category {
                CategoryName = "Foo"
            };
            var repo = new TestRepo(Context);

            repo.Add(cat, false);
            Assert.True(repo.HasChanges);
        }
예제 #2
0
        public void ShouldBeDirtyWhenRecordsUpdated()
        {
            ExecuteInATransaction(RunTheTest);

            void RunTheTest()
            {
                CreateCategoryAndProducts();
                var repo = new TestRepo(Context);
                var cat  = Context.Categories.First();

                cat.CategoryName = "Bar";
                Assert.True(repo.HasChanges);
            }
        }
예제 #3
0
        public void ShouldBeDirtyWhenRecordsDeleted()
        {
            ExecuteInATransaction(RunTheTest);

            void RunTheTest()
            {
                CreateCategoryAndProducts();
                var repo = new TestRepo(Context);
                var cat  = repo.Find(1);

                repo.Delete(cat, false);
                Assert.True(repo.HasChanges);
            }
        }