Пример #1
0
        public void PublishingDraft_CreatesNewPart()
        {
            PersistableItem root = CreateOneItem<PersistableItem>(0, "root", null);
            persister.Save(root);

            var draft = versioner.AddVersion(root, asPreviousVersion: false);
            var part = new PersistablePart { Title = "part", Name = "part" };
            part.ZoneName = "TheZone";
            part.AddTo(draft);

            var master = versioner.MakeMasterVersion(draft);

            var addedChild = master.Children.Single();
            addedChild.State.ShouldBe(ContentState.Published);
            N2.Utility.CurrentTime().ShouldBeGreaterThanOrEqualTo(addedChild.Published.Value);
            addedChild.ID.ShouldNotBe(0);
            addedChild.VersionOf.HasValue.ShouldBe(false);
            addedChild.Title.ShouldBe("part");
        }
Пример #2
0
        public void PublishingDraft_CreatesNewPart_WithoutRemovingExpiryDate()
        {
            PersistableItem root = CreateOneItem<PersistableItem>(0, "root", null);
            persister.Save(root);
            
            var draft = versioner.AddVersion(root, asPreviousVersion: false);
            var part = new PersistablePart { Title = "part", Name = "part" };
            part.ZoneName = "TheZone";
            var now = DateTime.Now.StripMilliseconds();
            part.Expires = now;
            part.AddTo(draft);

            var master = versioner.MakeMasterVersion(draft);

            var addedChild = master.Children.Single();
            addedChild.Expires.Value.ShouldBe(now);
        }