コード例 #1
0
        public void UnsavedPart_IsSavedOnNewPageVersion()
        {
            var page = new StatefulPage();

            page.Title = "The page";
            persister.Save(page);

            var part = new StatefulPart();

            part.Title    = "New part";
            part.Parent   = page;
            part.ZoneName = "TheZone";

            var context = new CommandContext(definitions.GetDefinition(page.GetContentType()), part, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);

            var command = CreateCommand(context);

            dispatcher.Execute(command, context);

            var pageVersions = versions.GetVersionsOf(page);

            pageVersions.Count.ShouldBeGreaterThan(0);
            pageVersions.First().State.ShouldBe(ContentState.Draft);
            pageVersions.First().Children.Single().Title.ShouldBe("New part");
        }
コード例 #2
0
        private CommandContext ExecuteSave(StatefulPage page, StatefulPart part)
        {
            var context = new CommandContext(definitions.GetDefinition(page.GetContentType()), part, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);
            var command = CreateCommand(context);

            dispatcher.Execute(command, context);
            return(context);
        }
コード例 #3
0
		public void Clears_PublishedDate()
		{
			var item = new StatefulPage();
			var context = new CommandContext(definitions.GetDefinition(item.GetContentType()), item, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);

			var command = CreateCommand(context);
			dispatcher.Execute(command, context);

			Assert.That(item.Published, Is.Null);
		}
コード例 #4
0
        public void Clears_PublishedDate()
        {
            var item    = new StatefulPage();
            var context = new CommandContext(definitions.GetDefinition(item.GetContentType()), item, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);

            var command = CreateCommand(context);

            dispatcher.Execute(command, context);

            Assert.That(item.Published, Is.Null);
        }
コード例 #5
0
		public void UnsavedPart_IsSavedOnNewPageVersion()
		{
			var page = new StatefulPage();
			page.Title = "The page";
			persister.Save(page);
			
			var part = new StatefulPart();
			part.Title = "New part";
			part.Parent = page;
			part.ZoneName = "TheZone";

			var context = new CommandContext(definitions.GetDefinition(page.GetContentType()), part, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);

			var command = CreateCommand(context);
			dispatcher.Execute(command, context);

			var pageVersions = versions.GetVersionsOf(page);
			pageVersions.Count.ShouldBeGreaterThan(0);
			pageVersions.First().State.ShouldBe(ContentState.Draft);
			pageVersions.First().Children.Single().Title.ShouldBe("New part");
		}
コード例 #6
0
		private CommandContext ExecuteSave(StatefulPage page, StatefulPart part)
		{
			var context = new CommandContext(definitions.GetDefinition(page.GetContentType()), part, Interfaces.Editing, CreatePrincipal("admin"), nullBinder, nullValidator);
			var command = CreateCommand(context);
			dispatcher.Execute(command, context);
			return context;
		}