public void VersionStoreAndLoad_StoresDisplayTypes()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1", "", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement));

            // None of the defaults are no display, therefore this should set all to a new value
            cv.SetDisplayTypeForVersion(FileUpdateType.NetAssembly, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.NetFile, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.NetInformational, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.Wix, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.StdAssembly, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.StdFile, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.StdInformational, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.Nuspec, DisplayType.NoDisplay);

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

            // Check that all of the display types come back as epxected
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.NetAssembly));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.NetFile));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.NetInformational));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.Wix));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.StdAssembly));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.StdFile));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.StdInformational));
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.Nuspec));
        }
Beispiel #2
0
        private static void CreateNewVersionStore()
        {
            string startVer = "0.0.0.0";

            if (!string.IsNullOrEmpty(options.QuickValue))
            {
                Console.WriteLine($"Using Value From Command Line: {options.QuickValue}");
                startVer = options.QuickValue;
            }
            if (!string.IsNullOrEmpty(options.QuickValue))
            {
                Console.WriteLine($"Setting Release From Command Line: {options.Release}");
            }
            Console.WriteLine($"Creating New Version Store: {startVer}");

            CompleteVersion cv = new CompleteVersion(startVer);

            versionerUsed = cv;

            cv.ReleaseName = options.Release;
            VersionStorage vs = new JsonVersionPersister(options.VersionPersistanceValue);

            Console.WriteLine($"Saving {cv.GetVersionString()}");
            vs.Persist(cv);
        }
Beispiel #3
0
        public void ManualExportVersionFile()
        {
            CompleteVersion cv = new CompleteVersion(new VersionUnit("1"), new VersionUnit("0", "."), new VersionUnit("Unicorn", "-"), new VersionUnit("0", ".", VersionIncrementBehaviour.AutoIncrementWithResetAny));
            VersionStorage  vs = new JsonVersionPersister(@"c:\temp\output.json");

            vs.Persist(cv);
        }
        private string CreateStoredVersionNumer()
        {
            var                  fn  = uth.NewTemporaryFileName(true);
            CompleteVersion      cv  = GetDefaultVersion();
            JsonVersionPersister jvp = new JsonVersionPersister(fn);

            jvp.Persist(cv);
            return(fn);
        }
        public void VersionStorage_Json_Saves()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1"));

            sut.Persist(cv);
            Assert.True(File.Exists(fn), "The file must be created");
        }
        public void VersionStorage_Json_Loads()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement), new VersionUnit("Alpha", "-"), new VersionUnit("1"), new VersionUnit("1", "", DigitIncremementBehaviour.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.Increment(); cv2.Increment();
            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The loaded type was not the same as the saved one, behaviours");
        }
        public void VersionStoreAndLoad_StoresUpdatedValues()
        {
            string fn  = uth.NewTemporaryFileName(true);
            var    sut = new JsonVersionPersister(fn);
            var    cv  = new CompleteVersion(new VersionUnit("1", "", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement),
                                             new VersionUnit("1", ".", DigitIncremementBehaviour.ContinualIncrement));

            cv.Increment();
            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.Increment(); cv2.Increment();
            Assert.Equal(cv.GetVersionString(), cv2.GetVersionString()); //, "The two version strings should match");
        }
Beispiel #8
0
        public void VersionStoreAndLoad_StoresDisplayTypes()
        {
            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));

            // None of the defaults are no display, therefore this should set all to a new value
            cv.SetDisplayTypeForVersion(FileUpdateType.Assembly4, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.AssemblyFile, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.AssemblyInformational, DisplayType.NoDisplay);
            cv.SetDisplayTypeForVersion(FileUpdateType.Wix, DisplayType.NoDisplay);

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

            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.Assembly4));             //, "The file update type assembly was not returned correctly");
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.AssemblyFile));          //, "The file update type AssemblyFile was not returned correctly");
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.AssemblyInformational)); //, "The file update type AssemblyInformational was not returned correctly");
            Assert.Equal(DisplayType.NoDisplay, cv2.GetDisplayType(FileUpdateType.Wix));                   //, "The file update type assembly was not returned correctly");
        }
Beispiel #9
0
        private static void CreateNewPendingIncrement()
        {
            var        per = new JsonVersionPersister(Program.options.VersionPersistanceValue);
            Versioning ver = new Versioning(per);

            versionerUsed = ver.Version;

            string verPendPattern = options.QuickValue;

            Console.WriteLine($"Apply Delayed Incremenet. [{ver.ToString()}] using [{verPendPattern}]");
            ver.Version.ApplyPendingVersion(verPendPattern);

            if (!options.TestMode)
            {
                per.Persist(ver.Version);
                ver.Increment();
                Console.WriteLine($"Saving Overriden Version [{ver.GetVersion()}]");
            }
            else
            {
                ver.Version.Increment();
                Console.WriteLine($"Would Save " + ver.Version.ToString());
            }
        }