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"); }
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); }
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); }
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; }