示例#1
0
        public override void SetUp()
        {
            base.SetUp();
            CreateDatabaseSchema();

            sessionProvider = engine.Resolve <ISessionProvider>();
            repository      = new ContentItemRepository(sessionProvider);

            all = new ContentItem []
            {
                root        = CreateOneItem <Definitions.PersistableItem>(0, "page", null),
                child1      = CreateOneItem <Definitions.PersistableItem>(0, "page1", root),
                grandchild1 = CreateOneItem <Definitions.PersistableItem>(0, "page1_1", child1),
                part1       = CreateOneItem <Definitions.PersistablePart>(0, "part1", child1),
                part2       = CreateOneItem <Definitions.PersistablePart>(0, "part1", child1),
                child2      = CreateOneItem <Definitions.PersistableItem>(0, "page2", root),
                version     = CreateOneItem <Definitions.PersistableItem>(0, "page1", null)
            };
            part1.ZoneName     = "Left";
            part2.ZoneName     = "RecursiveLeft";
            child1["Hello"]    = "World";
            child2["Age"]      = 2.7;
            grandchild1["Age"] = 1.7;

            version.VersionOf = child1;
            foreach (var item in all)
            {
                repository.SaveOrUpdate(all);
            }
        }
		public override void SetUp()
		{
			base.SetUp();
			CreateDatabaseSchema();

			sessionProvider = engine.Resolve<ISessionProvider>();
			repository = new ContentItemRepository(sessionProvider);

			all = new ContentItem []
			{
				root = CreateOneItem<Definitions.PersistableItem>(0, "page", null),
				child1 = CreateOneItem<Definitions.PersistableItem>(0, "page1", root),
				grandchild1 = CreateOneItem<Definitions.PersistableItem>(0, "page1_1", child1),
				part1 = CreateOneItem<Definitions.PersistablePart>(0, "part1", child1),
				part2 = CreateOneItem<Definitions.PersistablePart>(0, "part1", child1),
				child2 = CreateOneItem<Definitions.PersistableItem>(0, "page2", root),
				version = CreateOneItem<Definitions.PersistableItem>(0, "page1", null)
			};
			part1.ZoneName = "Left";
			part2.ZoneName = "RecursiveLeft";
			child1["Hello"] = "World";
			child2["Age"] = 2.7;
			grandchild1["Age"] = 1.7;

			version.VersionOf = child1;
            foreach (var item in all)
                repository.SaveOrUpdate(all);
		}
示例#3
0
        public void CanUpdate()
        {
            int itemID = SaveAnItem("savedItem", null);

            using (repository)
            {
                ContentItem item = repository.Get(itemID);
                item.Title = "updated item";
                repository.SaveOrUpdate(item);
                repository.Flush();
            }

            using (repository)
            {
                ContentItem item = repository.Get(itemID);
                Assert.AreEqual("updated item", item.Title);
                repository.Delete(item);
                repository.Flush();
            }
        }