예제 #1
0
        public void DeleteItemCascadesDetails()
        {
            IRepository <ContentDetail> detailRepository = new NHRepository <ContentDetail>(sessionProvider);
            int itemID = 0;

            using (repository)
            {
                ContentItem item = CreateOneItem <Definitions.PersistableItem>(0, "item", null);
                item["TheString"] = "the string";
                repository.Save(item);
                repository.Flush();
                itemID = item.ID;
            }
            using (detailRepository)
            {
                Assert.AreEqual(1, detailRepository.Count());
            }
            using (repository)
            {
                ContentItem item = repository.Get(itemID);
                repository.Delete(item);
                repository.Flush();
            }
            using (detailRepository)
            {
                Assert.AreEqual(0, detailRepository.Count());
            }
        }
예제 #2
0
        public void CanDeleteDetail()
        {
            IRepository<ContentDetail> detailRepository = new NHRepository<ContentDetail>(sessionProvider);

            using (repository)
            {
                ContentItem item = CreateOneItem<Definitions.PersistableItem1>(0, "item", null);
                item["TheString"] = "the string";
                repository.Save(item);
                repository.Flush();

                Assert.AreEqual(1, detailRepository.Count());

                item["TheString"] = null;
                repository.Save(item);
                repository.Flush();

                Assert.AreEqual(0, detailRepository.Count());
            }
        }
예제 #3
0
        public void CanDeleteDetail()
        {
            IRepository <ContentDetail> detailRepository = new NHRepository <ContentDetail>(sessionProvider);

            using (repository)
            {
                ContentItem item = CreateOneItem <Definitions.PersistableItem>(0, "item", null);
                item["TheString"] = "the string";
                repository.Save(item);
                repository.Flush();

                Assert.AreEqual(1, detailRepository.Count());

                item["TheString"] = null;
                repository.Save(item);
                repository.Flush();

                Assert.AreEqual(0, detailRepository.Count());
            }
        }
예제 #4
0
        public void DeleteItemCascadesDetails()
        {
            IRepository<ContentDetail> detailRepository = new NHRepository<ContentDetail>(sessionProvider);
            int itemID = 0;

            using (repository)
            {
                ContentItem item = CreateOneItem<Definitions.PersistableItem1>(0, "item", null);
                item["TheString"] = "the string";
                repository.Save(item);
                repository.Flush();
                itemID = item.ID;
            }
            using(detailRepository)
            {
                Assert.AreEqual(1, detailRepository.Count());
            }
            using(repository)
            {
                ContentItem item = repository.Get(itemID);
                repository.Delete(item);
                repository.Flush();
            }
            using(detailRepository)
            {
                Assert.AreEqual(0, detailRepository.Count());
            }
        }