Exemple #1
0
        public void SimpleIncrement_Fixed_DoesNothing()
        {
            var sut = new CompleteVersion(new VersionUnit("1"), new VersionUnit("2", "."));

            sut.PerformIncrement();
            Assert.Equal("1.2", sut.ToString());
        }
Exemple #2
0
        public void PartiallyFixed_DoesIncrement()
        {
            var sut = new CompleteVersion(new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement), new VersionUnit("Monkey", "."));

            sut.PerformIncrement();
            Assert.Equal("2.Monkey", sut.GetVersionString(DisplayType.FullIncludeText)); // The increment for the first digit did not work in a mixed verison number
        }
Exemple #3
0
        public void FixedBehaviour_DoesNotIncrement()
        {
            var    sut    = new CompleteVersion(new VersionUnit("2"), new VersionUnit("0", "."));
            string before = sut.GetVersionString(DisplayType.Full);

            sut.PerformIncrement();
            Assert.Equal(before, sut.GetVersionString(DisplayType.Full)); // Digits should be fixed and not change when incremented
        }
        public void Display_Assem2_AllDigits_Correct()
        {
            var sut           = new CompleteVersion(new VersionUnit("2"), new VersionUnit("0", "."), new VersionUnit("0", "."), new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement));
            var fut2          = sut.GetDisplayType(FileUpdateType.Assembly2);
            var verStringFor2 = sut.GetVersionString(fut2);

            Assert.Equal("2.0", verStringFor2);

            sut.PerformIncrement();
            verStringFor2 = sut.GetVersionString(fut2);

            Assert.Equal("2.0", verStringFor2);

            sut.PerformIncrement();
            verStringFor2 = sut.GetVersionString(fut2);

            Assert.Equal("2.0", verStringFor2);
        }
Exemple #5
0
        public void Increment_ResentAnyWorks()
        {
            var vu2 = new VersionUnit("0", ".");
            var sut = new CompleteVersion(
                new VersionUnit("1", ""),
                vu2,
                new VersionUnit("1", "."),
                new VersionUnit("0", ".", VersionIncrementBehaviour.AutoIncrementWithResetAny));

            Assert.Equal("1.0.1.0", sut.GetVersionString()); // Without an increment its wrong - invalid test

            sut.PerformIncrement();
            Assert.Equal("1.0.1.1", sut.GetVersionString()); // Increment on all fixed should not change anything
            vu2.IncrementOverride = "5";
            sut.PerformIncrement();

            Assert.Equal("1.5.1.0", sut.GetVersionString()); // The final digit should reset when a fixed digit changes.
        }
Exemple #6
0
        public void Increment_OverrideReplacesIncrement()
        {
            var vu = new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement);

            vu.IncrementOverride = "9";
            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();
            Assert.Equal("9", sut.GetVersionString(DisplayType.Full));
        }
Exemple #7
0
        public void SimpleIncrement_Incrment_Works()
        {
            var vu = new VersionUnit("2", ".");

            vu.SetBehaviour(VersionIncrementBehaviour.AutoIncrementWithReset);
            var sut = new CompleteVersion(new VersionUnit("1"), vu);

            sut.PerformIncrement();
            Assert.Equal("1.3", sut.ToString());
        }
Exemple #8
0
        public void Increment_ResetAnyWorks()
        {
            var sut = new CompleteVersion(
                new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement),
                new VersionUnit("0", "."),
                new VersionUnit("1", "."),
                new VersionUnit("0", ".", VersionIncrementBehaviour.AutoIncrementWithResetAny));

            sut.PerformIncrement();
            Assert.Equal("2.0.1.0", sut.GetVersionString(DisplayType.Full)); //  The reset should prevent the last digit from incrementing
        }
        public void UseCase_Plisky_Works()
        {
            var sut = new CompleteVersion(
                new VersionUnit("2"),
                new VersionUnit("0", "."),
                new VersionUnit("Unicorn", "-"),
                new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement));

            var verString = sut.GetVersionString(DisplayType.FullIncludeText);

            Assert.Equal("2.0-Unicorn.0", verString);

            sut.PerformIncrement();
            verString = sut.GetVersionString(DisplayType.FullIncludeText);
            Assert.Equal("2.0-Unicorn.1", verString);

            sut.PerformIncrement();
            verString = sut.GetVersionString(DisplayType.FullIncludeText);
            Assert.Equal("2.0-Unicorn.2", verString);
        }
Exemple #10
0
        public void Increment_OverrideWorksOnFixed()
        {
            var vu = new VersionUnit("1", "", VersionIncrementBehaviour.Fixed);

            vu.IncrementOverride = "Fish";

            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();

            Assert.Equal("Fish", sut.GetVersionString(DisplayType.Full)); //, "The overide on a word value did not work");
        }
Exemple #11
0
        public void Increment_OverrideWorksForNumbers()
        {
            var vu = new VersionUnit("1");

            vu.IncrementOverride = "5";

            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();

            Assert.Equal("5", sut.GetVersionString(DisplayType.Full));
        }
        public void VersionStoreAndLoad_StoresUpdatedValues()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", VersionIncrementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", VersionIncrementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", VersionIncrementBehaviour.ContinualIncrement));

            cv.PerformIncrement();
            var beforeStore = cv.GetVersionString();

            sut.Persist(cv);
            var cv2 = sut.GetVersion();

            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The two version strings should match");
            Assert.Equal("2.2.2.2", cv2.GetVersionString());             //, "The loaded version string should keep the increment");

            cv.PerformIncrement(); cv2.PerformIncrement();
            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The two version strings should match");
        }
Exemple #13
0
        public void Increment_OverrideWorksForNames()
        {
            var vu = new VersionUnit("Monkey");

            vu.IncrementOverride = "Fish";

            var sut = new CompleteVersion(vu);

            sut.PerformIncrement();

            Assert.Equal("Fish", sut.GetVersionString(DisplayType.FullIncludeText)); //, "The overide on a word value did not work");
        }
        public void Display_Assem4_AllDigitsMultiIncrement_Correct()
        {
            var sut = new CompleteVersion(new VersionUnit("2", "", VersionIncrementBehaviour.ContinualIncrement),
                                          new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement),
                                          new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement),
                                          new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement)
                                          );

            var fut4          = sut.GetDisplayType(FileUpdateType.Assembly4);
            var verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("2.0.0.0", verStringFor4);

            sut.PerformIncrement();
            verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("3.1.1.1", verStringFor4);

            sut.PerformIncrement();
            verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("4.2.2.2", verStringFor4);
        }
        public void VersionStorage_Json_Loads()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1", ".", VersionIncrementBehaviour.ContinualIncrement), new VersionUnit("Alpha", "-"), new VersionUnit("1"), new VersionUnit("1", "", VersionIncrementBehaviour.ContinualIncrement));

            sut.Persist(cv);

            var cv2 = sut.GetVersion();

            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The loaded type was not the same as the saved one, values");
            cv.PerformIncrement(); cv2.PerformIncrement();
            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The loaded type was not the same as the saved one, behaviours");
        }
        public void Display_Assem4_TextComponent_Correct()
        {
            var sut = new CompleteVersion(new VersionUnit("2"),
                                          new VersionUnit("0", "."),
                                          new VersionUnit("Unicorn", "-"),
                                          new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement)
                                          );

            var fut4          = sut.GetDisplayType(FileUpdateType.Assembly4);
            var verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("2.0.0.0", verStringFor4);

            sut.PerformIncrement();
            verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("2.0.0.1", verStringFor4);

            sut.PerformIncrement();
            verStringFor4 = sut.GetVersionString(fut4);

            Assert.Equal("2.0.0.2", verStringFor4);
        }
        public void UseCase_PliskyFileTypes_Works()
        {
            var sut     = new CompleteVersion(new VersionUnit("2"), new VersionUnit("0", "."), new VersionUnit("Unicorn", "-"), new VersionUnit("0", ".", VersionIncrementBehaviour.ContinualIncrement));
            var fut4    = sut.GetDisplayType(FileUpdateType.Assembly4);
            var fut2    = sut.GetDisplayType(FileUpdateType.Assembly2);
            var futInfo = sut.GetDisplayType(FileUpdateType.AssemblyInformational);

            var verStringFor4    = sut.GetVersionString(fut4);
            var verStringFor2    = sut.GetVersionString(fut2);
            var verStringForInfo = sut.GetVersionString(futInfo);

            // Initial values not incremented
            Assert.Equal("2.0.0.0", verStringFor4);
            Assert.Equal("2.0", verStringFor2);
            Assert.Equal("2.0-Unicorn.0", verStringForInfo);

            sut.PerformIncrement();
            verStringFor4    = sut.GetVersionString(fut4);
            verStringFor2    = sut.GetVersionString(fut2);
            verStringForInfo = sut.GetVersionString(futInfo);

            // Values Following Single Increment
            Assert.Equal("2.0.0.1", verStringFor4);
            Assert.Equal("2.0", verStringFor2);
            Assert.Equal("2.0-Unicorn.1", verStringForInfo);

            sut.PerformIncrement();
            verStringFor4    = sut.GetVersionString(fut4);
            verStringFor2    = sut.GetVersionString(fut2);
            verStringForInfo = sut.GetVersionString(futInfo);

            // Values Following Second Increment
            Assert.Equal("2.0.0.2", verStringFor4);
            Assert.Equal("2.0", verStringFor2);
            Assert.Equal("2.0-Unicorn.2", verStringForInfo);
        }