Пример #1
0
        public void SavingAction_On_None_Locked_CheckIn1()
        {
            Test(() =>
            {
                //1.0A	1.0A
                //1.1D	1.1D
                //2.0A	2.0A
                //2.1D	2.2P <--
                //2.2L <--

                var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.None);

                InitializeAsExisting(gc, 1, 115, "V2.2.L");

                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 112),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.A"), 113),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.1.D"), 114),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.2.L"), 115)
                });
                action.CheckIn();

                Assert.IsNotNull(action.ExpectedVersion);
                Assert.AreEqual("V3.0.P", action.ExpectedVersion.ToString());
                Assert.AreEqual(115, action.ExpectedVersionId);
                Assert.AreEqual(1, action.DeletableVersionIds.Count);
                Assert.IsTrue(action.DeletableVersionIds.Contains(114));
            });
        }
Пример #2
0
        public void SavingAction_On_None_Locked_CheckIn1()
        {
            // do not save the content in this test
            // do not change the parent to TestRoot

            //1.0A	1.0A
            //1.1D	1.1D
            //2.0A	2.0A
            //2.1D	2.2P <--
            //2.2L <--

            var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.None);

            InitializeAsExisting(gc, 100, 115, "V2.2.L");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 112),
                new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.A"), 113),
                new NodeHead.NodeVersion(VersionNumber.Parse("V2.1.D"), 114),
                new NodeHead.NodeVersion(VersionNumber.Parse("V2.2.L"), 115)
            });
            action.CheckIn();

            Assert.IsTrue(action.ExpectedVersion != null, "ExpectedVersion is null");
            Assert.IsTrue(action.ExpectedVersion.ToString() == "V3.0.P", String.Concat("ExpectedVersion is ", action.ExpectedVersion.ToString(), ". Expected: V2.1.P"));
            Assert.IsTrue(action.ExpectedVersionId == 115, String.Concat("ExpectedVersionId is ", action.ExpectedVersionId, ". Expected:115"));
            Assert.IsTrue(action.DeletableVersionIds.Count == 1, String.Concat("DeletableVersionIds contains ", action.DeletableVersionIds.Count, "items. Expected: 1"));
            Assert.IsTrue(action.DeletableVersionIds.Contains(114), String.Concat("DeletableVersionIds does not contain 114"));
        }
Пример #3
0
        public void SavingAction_Default_Default_Create_SaveAndCheckIn()
        {
            var content = Content.CreateNew("Car", Repository.Root, "car");
            var action  = SavingAction.Create(content.ContentHandler);

            action.CheckOut();
        }
Пример #4
0
        public void SavingAction_Off_Major_Locked_CheckIn_Repair1()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.MajorOnly);

                InitializeAsExisting(gc, 2, 116, "V3.2.L");

                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.2.D"), 112),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.R"), 113),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V3.0.P"), 114),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V3.1.P"), 115),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V3.2.L"), 116)
                });

                action.CheckIn();

                SavingAssert(action, "V3.2.L", 116, "V2.0.A", 116, 0, new List <int> {
                    112, 113, 114, 115
                });
            });
        }
Пример #5
0
        public void SavingAction_Off_None_Locked_CheckIn1()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.None);

                InitializeAsExisting(gc, 2, 113, "V1.2.L");

                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 112),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.2.L"), 113)
                });
                action.CheckIn();

                Assert.IsNotNull(action.ExpectedVersion);
                Assert.AreEqual("V1.0.A", action.ExpectedVersion.ToString());
                Assert.AreEqual(111, action.ExpectedVersionId);
                Assert.AreEqual(2, action.DeletableVersionIds.Count);
                Assert.IsTrue(action.DeletableVersionIds.Contains(113));
                Assert.IsTrue(action.DeletableVersionIds.Contains(112));
            });
        }
Пример #6
0
        public void SavingAction_On_Major_Pending_Approve2()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.MajorOnly);

                InitializeAsExisting(gc, 2, 114, "V4.0.P");

                var action = SavingAction.Create(gc);

                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.P"), 112),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V3.0.P"), 113),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V4.0.P"), 114)
                });

                action.Approve();

                SavingAssert(action, "V4.0.P", 114, "V2.0.A", 114, null, new List <int> {
                    112, 113
                });
            });
        }
Пример #7
0
        public static void MultistepSave(Node node)
        {
            var savingAction = SavingAction.Create(node);

            savingAction.MultistepSaving   = true;
            savingAction.ExpectedVersionId = node.VersionId;
            savingAction.Execute();
        }
Пример #8
0
 public void SavingAction_Default_Default_Create_SaveAndCheckIn()
 {
     Test(() =>
     {
         var content = Content.CreateNew("SystemFolder", Repository.Root, "SystemFolder1");
         var action  = SavingAction.Create(content.ContentHandler);
         action.CheckOut();
     });
 }
Пример #9
0
        private static void CreatingTest(bool hasApproving, VersioningType mode, string expectedVersion)
        {
            var gc = CreateNodeInMemory(hasApproving ? ApprovingType.True : ApprovingType.False, mode);

            var action = SavingAction.Create(gc);

            action.CheckOutAndSave();

            Assert.IsTrue(action.CurrentVersion == null, "action.CurrentVersion is not null");
            Assert.IsTrue(action.CurrentVersionId == 0, $"action.CurrentVersionId is {action.CurrentVersionId}. Expected: 0");
            Assert.IsTrue(action.ExpectedVersion != null, "action.ExpectedVersion is null");
            Assert.IsTrue(action.ExpectedVersion.ToString() == expectedVersion, $"action.CurrentVersion is {action.ExpectedVersion}. Expected: {expectedVersion}.");
            Assert.IsTrue(action.ExpectedVersionId == 0, $"action.ExpectedVersionId is ", action.ExpectedVersionId, ". Expected: 0");
            Assert.IsTrue(action.LockerUserId == null, "action.LockerUserId not null");
            Assert.IsTrue(action.DeletableVersionIds.Count == 0, $"action..DeletableVersions.Count is {action.DeletableVersionIds.Count}. Expected: 0");
        }
Пример #10
0
        public void SavingAction_Off_MajorMinor_StartMultistepSave_03()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.MajorAndMinor);

                InitializeAsExisting(gc, 1, 111, "V1.1.L", true, 100, DateTime.Today);
                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 110),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.L"), 111)
                });
                action.StartMultistepSave();
            });
        }
Пример #11
0
        public void SavingAction_On_None_Pending_Reject1()
        {
            var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.None);

            InitializeAsExisting(gc, 123, 111, "V1.0.P");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.P"), 111)
            });

            action.Reject();

            SavingAssert(action, "V1.0.P", 111, "V1.0.R", 111, null, new List <int>());
        }
Пример #12
0
        public void SavingAction_Off_None_Approved_Save()
        {
            // do not save the content in this test
            // do not change the parent to TestRoot
            var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.None);

            InitializeAsExisting(gc, 123, 456, "V1.0.A");
            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 456)
            });

            action.CheckOutAndSave();
            SavingAssert(action, "V1.0.A", 456, "V2.0.L", 0, 1, new List <int>());
        }
Пример #13
0
        public void SavingAction_Off_None_Approved_Save()
        {
            Test(true, () =>
            {
                var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.None);

                InitializeAsExisting(gc, 2, 456, "V1.0.A");
                var action = SavingAction.Create(gc);

                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 456)
                });

                action.CheckOutAndSave();
                SavingAssert(action, "V1.0.A", 456, "V2.0.L", 0, 1, new List <int>());
            });
        }
Пример #14
0
        public void SavingAction_Off_MajorMinor_StartMultistepSave_02()
        {
            Test(true, () =>
            {
                var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.MajorAndMinor);

                InitializeAsExisting(gc, 1, 111, "V2.0.A");
                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 110),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.A"), 111)
                });
                action.StartMultistepSave();

                SavingAssert(action, "V2.0.A", 111, "V2.1.L", 0, 1, new List <int>());
            });
        }
Пример #15
0
        public void SavingAction_Off_Full_Draft_Publish1()
        {
            var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.MajorAndMinor);

            InitializeAsExisting(gc, 123, 112, "V1.1.D");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 112)
            });

            action.Publish();

            SavingAssert(action, "V1.1.D", 112, "V2.0.A", 112, 0, new List <int>());
        }
Пример #16
0
        public void SavingAction_On_Full_Pending_Approve2()
        {
            var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.MajorAndMinor);

            InitializeAsExisting(gc, 123, 113, "V0.3.P");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V0.1.P"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V0.2.D"), 112),
                new NodeHead.NodeVersion(VersionNumber.Parse("V0.3.P"), 113)
            });

            action.Approve();

            SavingAssert(action, "V0.3.P", 113, "V1.0.A", 113, null, new List <int>());
        }
Пример #17
0
        public void SavingAction_On_Full_Draft_Publish2()
        {
            var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.MajorAndMinor);

            InitializeAsExisting(gc, 123, 115, "V1.2.R");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V0.1.P"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V0.2.D"), 112),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 113),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 114),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.2.R"), 115)
            });

            action.Publish();

            SavingAssert(action, "V1.2.R", 115, "V1.3.P", 0, 0, new List <int>());
        }
Пример #18
0
        public void SavingAction_On_Full_Locked_Publish1()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.MajorAndMinor);

                InitializeAsExisting(gc, 2, 113, "V1.2.L");

                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.1.D"), 112),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.2.L"), 113)
                });

                action.Publish();

                SavingAssert(action, "V1.2.L", 113, "V1.2.P", 113, 0, new List <int>());
            });
        }
Пример #19
0
        public void SavingAction_Off_Major_SaveAndCheckIn_Repair1()
        {
            var gc = CreateNodeInMemory(ApprovingType.False, VersioningType.MajorOnly);

            InitializeAsExisting(gc, 123, 114, "V3.0.P");

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.2.D"), 112),
                new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.R"), 113),
                new NodeHead.NodeVersion(VersionNumber.Parse("V3.0.P"), 114)
            });

            action.CheckOutAndSaveAndCheckIn();

            SavingAssert(action, "V3.0.P", 114, "V2.0.A", 114, 0, new List <int> {
                112, 113
            });
        }
Пример #20
0
        public void SavingAction_On_None_Locked_UndoCheckOut_Bug1814()
        {
            // do not save the content in this test
            // do not change the parent to TestRoot
            var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.None);

            InitializeAsExisting(gc, 100, 111, "V1.0.A", true, 1, DateTime.Now);

            var action = SavingAction.Create(gc);

            SetVersionHistory(action, gc, new[]
            {
                new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.L"), 112)
            });
            action.UndoCheckOut();

            Assert.IsTrue(action.ExpectedVersion != null, "ExpectedVersion is null");
            Assert.IsTrue(action.ExpectedVersion.ToString() == "V1.0.A", String.Concat("ExpectedVersion is ", action.ExpectedVersion.ToString(), ". Expected: V1.0.A"));
            Assert.IsTrue(action.ExpectedVersionId == 111, String.Concat("ExpectedVersionId is ", action.ExpectedVersionId, ". Expected:111"));
            Assert.IsTrue(action.DeletableVersionIds.Count == 1, String.Concat("DeletableVersionIds contains ", action.DeletableVersionIds.Count, "items. Expected: 1"));
            Assert.IsTrue(action.DeletableVersionIds.Contains(112), String.Concat("DeletableVersionIds does not contain 112"));
        }
Пример #21
0
        public void SavingAction_On_None_Locked_UndoCheckOut_Bug1814()
        {
            Test(() =>
            {
                var gc = CreateNodeInMemory(ApprovingType.True, VersioningType.None);

                InitializeAsExisting(gc, 1, 111, "V1.0.A", true, 1, DateTime.UtcNow);

                var action = SavingAction.Create(gc);
                SetVersionHistory(action, gc, new[]
                {
                    new NodeHead.NodeVersion(VersionNumber.Parse("V1.0.A"), 111),
                    new NodeHead.NodeVersion(VersionNumber.Parse("V2.0.L"), 112)
                });
                action.UndoCheckOut();

                Assert.IsNotNull(action.ExpectedVersion);
                Assert.AreEqual("V1.0.A", action.ExpectedVersion.ToString());
                Assert.AreEqual(111, action.ExpectedVersionId);
                Assert.AreEqual(1, action.DeletableVersionIds.Count);
                Assert.IsTrue(action.DeletableVersionIds.Contains(112));
            });
        }