コード例 #1
0
    public void Json()
    {
        var semanticVersion = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            PreReleaseTag = "unstable4",
            BuildMetaData = new SemanticVersionBuildMetaData(5, "feature1", "commitSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z"))
        };
        var variables = VariableProvider.GetVariablesFor(semanticVersion, new Config());
        var json      = JsonOutputFormatter.ToJson(variables);

        Approvals.Verify(json);
    }
コード例 #2
0
    public void Json()
    {
        var semanticVersion = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            PreReleaseTag = "unstable4",
            BuildMetaData = new SemanticVersionBuildMetaData(5, "feature1", "commitSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z"))
        };
        var variables = VariableProvider.GetVariablesFor(semanticVersion, AssemblyVersioningScheme.MajorMinorPatch, VersioningMode.ContinuousDelivery, "ci", false);
        var json      = JsonOutputFormatter.ToJson(variables);

        Approvals.Verify(json);
    }
コード例 #3
0
    public void ProvidesVariablesInContinuousDeploymentModeForStable()
    {
        var semVer = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            BuildMetaData = "5.Branch.develop"
        };

        semVer.BuildMetaData.Sha        = "commitSha";
        semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");

        var vars = VariableProvider.GetVariablesFor(semVer, AssemblyVersioningScheme.MajorMinorPatch, VersioningMode.ContinuousDeployment, "ci", false);

        Approvals.Verify(JsonOutputFormatter.ToJson(vars));
    }
コード例 #4
0
    public void Json()
    {
        var semanticVersion = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 0,
            PreReleaseTag = "unstable4",
            BuildMetaData = new SemanticVersionBuildMetaData(5, "feature1", "commitSha", "commitShortSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z"))
        };

        var config = new TestEffectiveConfiguration();

        var variables = VariableProvider.GetVariablesFor(semanticVersion, config, false);
        var json      = JsonOutputFormatter.ToJson(variables);

        json.ShouldMatchApproved(c => c.SubFolder("Approved"));
    }
コード例 #5
0
    public void ProvidesVariablesInContinuousDeploymentModeForStable()
    {
        var semVer = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            BuildMetaData = "5.Branch.develop"
        };

        semVer.BuildMetaData.Sha        = "commitSha";
        semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");

        var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment);

        var vars = VariableProvider.GetVariablesFor(semVer, config, false);

        JsonOutputFormatter.ToJson(vars).ShouldMatchApproved();
    }
コード例 #6
0
    public void ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged()
    {
        var semVer = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            BuildMetaData =
            {
                CommitsSinceTag =           5,
                Sha             = "commitSha",
                CommitDate      = DateTimeOffset.Parse("2014-03-06 23:59:59Z")
            }
        };


        var vars = VariableProvider.GetVariablesFor(semVer, AssemblyVersioningScheme.MajorMinorPatch, VersioningMode.ContinuousDeployment, "ci", true);

        Approvals.Verify(JsonOutputFormatter.ToJson(vars));
    }
コード例 #7
0
    public void ProvidesVariablesInContinuousDeliveryModeForPreReleaseWithPadding()
    {
        var semVer = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            PreReleaseTag = "unstable.4",
            BuildMetaData = "5.Branch.develop"
        };

        semVer.BuildMetaData.Sha        = "commitSha";
        semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");


        var config = new TestEffectiveConfiguration(buildMetaDataPadding: 2, legacySemVerPadding: 5);

        var vars = VariableProvider.GetVariablesFor(semVer, config, false);

        JsonOutputFormatter.ToJson(vars).ShouldMatchApproved();
    }
コード例 #8
0
    public void ProvidesVariablesInContinuousDeploymentModeForStableWhenCurrentCommitIsTagged()
    {
        var semVer = new SemanticVersion
        {
            Major         = 1,
            Minor         = 2,
            Patch         = 3,
            BuildMetaData =
            {
                CommitsSinceTag           =           5,
                CommitsSinceVersionSource =           5,
                Sha        = "commitSha",
                CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z")
            }
        };

        var config = new TestEffectiveConfiguration(versioningMode: VersioningMode.ContinuousDeployment);

        var vars = VariableProvider.GetVariablesFor(semVer, config, true);

        JsonOutputFormatter.ToJson(vars).ShouldMatchApproved();
    }
コード例 #9
0
        public void ProvidesVariablesInContinuousDeliveryModeForFeatureBranchWithCustomAssemblyInformationalFormat()
        {
            var semVer = new SemanticVersion
            {
                Major         = 1,
                Minor         = 2,
                Patch         = 3,
                BuildMetaData = "5.Branch.feature/123"
            };

            semVer.BuildMetaData.Branch           = "feature/123";
            semVer.BuildMetaData.VersionSourceSha = "versionSourceSha";
            semVer.BuildMetaData.Sha        = "commitSha";
            semVer.BuildMetaData.ShortSha   = "commitShortSha";
            semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");


            var config = new TestEffectiveConfiguration(assemblyInformationalFormat: "{Major}.{Minor}.{Patch}+{CommitsSinceVersionSource}.Branch.{BranchName}.Sha.{ShortSha}");

            var vars = variableProvider.GetVariablesFor(semVer, config, false);

            JsonOutputFormatter.ToJson(vars).ShouldMatchApproved(c => c.SubFolder("Approved"));
        }
コード例 #10
0
        public void Json()
        {
            var semanticVersion = new SemanticVersion
            {
                Major         = 1,
                Minor         = 2,
                Patch         = 0,
                PreReleaseTag = "unstable4",
                BuildMetaData = new SemanticVersionBuildMetaData("versionSourceSha", 5, "feature1", "commitSha", "commitShortSha", DateTimeOffset.Parse("2014-03-06 23:59:59Z"))
            };

            var config = new TestEffectiveConfiguration();

            var log = new NullLog();
            var metaDataCalculator        = new MetaDataCalculator();
            var baseVersionCalculator     = new BaseVersionCalculator(log, null);
            var mainlineVersionCalculator = new MainlineVersionCalculator(log, metaDataCalculator);
            var nextVersionCalculator     = new NextVersionCalculator(log, metaDataCalculator, baseVersionCalculator, mainlineVersionCalculator);
            var variableProvider          = new VariableProvider(nextVersionCalculator, new TestEnvironment());
            var variables = variableProvider.GetVariablesFor(semanticVersion, config, false);
            var json      = JsonOutputFormatter.ToJson(variables);

            json.ShouldMatchApproved(c => c.SubFolder("Approved"));
        }