public void VsoAgentBuildNumberWithFullSemVer(string buildNumberFormat, string myFullSemVer, string expectedBuildNumber)
 {
     Environment.SetEnvironmentVariable(key, buildNumberFormat, EnvironmentVariableTarget.Process);
     var vars = new TestableVersionVariables(fullSemVer: myFullSemVer);
     var logMessage = versionBuilder.GenerateSetVersionMessage(vars);
     logMessage.ShouldBe(logPrefix + expectedBuildNumber);
 }
Example #2
0
    public void VsoAgentBuildNumberWithFullSemVer()
    {
        examples.Add(new Tuple <string, string, string>("$(GitVersion.FullSemVer)", "1.0.0", "1.0.0"));
        examples.Add(new Tuple <string, string, string>("$(GITVERSION_FULLSEMVER)", "1.0.0", "1.0.0"));
        examples.Add(new Tuple <string, string, string>("$(GitVersion.FullSemVer)-Build.1234", "1.0.0", "1.0.0-Build.1234"));
        examples.Add(new Tuple <string, string, string>("$(GITVERSION_FULLSEMVER)-Build.1234", "1.0.0", "1.0.0-Build.1234"));

        foreach (var example in examples)
        {
            Environment.SetEnvironmentVariable(key, example.Item1, EnvironmentVariableTarget.Process);
            var vars = new TestableVersionVariables(fullSemVer: example.Item2);

            var logMessage = versionBuilder.GenerateSetVersionMessage(vars);
            logMessage.ShouldBe(logPrefix + example.Item3);
        }
    }
Example #3
0
    public void Develop_branch()
    {
        var versionBuilder = new VsoAgent();
        var vars           = new TestableVersionVariables(fullSemVer: "0.0.0-Unstable4");
        var vsVersion      = versionBuilder.GenerateSetVersionMessage(vars);

        vsVersion.ShouldBe("##vso[build.updatebuildnumber]Some Build_Value 0.0.0-Unstable4 20151310.3 $(UnknownVar) Release");
    }
Example #4
0
    public void Develop_branch()
    {
        var versionBuilder = new VsoAgent();
        var vsVersion      = versionBuilder.GenerateSetVersionMessage("0.0.0-Unstable4");

        //  Assert.AreEqual("##vso[task.setvariable variable=GitBuildNumber;]0.0.0-Unstable4", vsVersion);

        vsVersion.ShouldBe(null);
    }
Example #5
0
    public void MissingEnvShouldNotBlowUp()
    {
        Environment.SetEnvironmentVariable(key, null, EnvironmentVariableTarget.Process);

        var versionBuilder = new VsoAgent();
        var semver         = "0.0.0-Unstable4";
        var vars           = new TestableVersionVariables(fullSemVer: semver);
        var vsVersion      = versionBuilder.GenerateSetVersionMessage(vars);

        vsVersion.ShouldBe(semver);
    }
Example #6
0
    public void Develop_branch()
    {
        var versionBuilder = new VsoAgent();
        var vars           = new TestableVersionVariables(fullSemVer: "0.0.0-Unstable4");
        var vsVersion      = versionBuilder.GenerateSetVersionMessage(vars);

        vsVersion.ShouldBe("##vso[build.updatebuildnumber]Some Build_Value 0.0.0-Unstable4 20151310.3 $(UnknownVar) Release");

        ClearEnvironmentVariableForTest();
        Environment.SetEnvironmentVariable(tfsKey, "Some Build_Value $(GitVersion_FullSemVer) 20151310.3 $(UnknownVar) Release", EnvironmentVariableTarget.Process);

        vsVersion.ShouldBe("##vso[build.updatebuildnumber]Some Build_Value 0.0.0-Unstable4 20151310.3 $(UnknownVar) Release");
    }