Esempio n. 1
0
        public static Version Increment(this Version semVer, VersionIncrementType versionIncrement)
        {
            switch (versionIncrement)
            {
            case VersionIncrementType.Major: return(new Version(semVer.Major + 1, semVer.Minor, semVer.Patch));

            case VersionIncrementType.Minor: return(new Version(semVer.Major, semVer.Minor + 1, semVer.Patch));

            default: return(new Version(semVer.Major, semVer.Minor, semVer.Patch + 1));
            }
        }
Esempio n. 2
0
        protected ProductVersion CalculateNewVersion(ProductVersion?previousVersion, VersionIncrementType incrementType, Settings settings)
        {
            if (previousVersion == null)
            {
                return(new ProductVersion(settings.FirstVersion));
            }

            switch (incrementType)
            {
            case VersionIncrementType.Patch: return(previousVersion.Value.IncrementPatch());

            case VersionIncrementType.Minor: return(previousVersion.Value.IncrementMinor());

            case VersionIncrementType.Major: return(previousVersion.Value.IncrementMajor());

            default: throw new ArgumentException($"Unknown value for IncrementType: {incrementType}", nameof(incrementType));
            }
        }
        public void Increment(string version, VersionIncrementType versionIncrementType, string expectedResult)
        {
            string newVersion = new Version(version, true).Increment(versionIncrementType).ToString();

            Assert.Equal(expectedResult, newVersion);
        }