Ejemplo n.º 1
0
        private void AssertVariablesAreWrittenToFile(string file)
        {
            var writes          = new List <string>();
            var semanticVersion = new SemanticVersion
            {
                Major         = 1,
                Minor         = 2,
                Patch         = 3,
                PreReleaseTag = "beta1",
                BuildMetaData = "5"
            };

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

            var config = new TestEffectiveConfiguration();

            var variableProvider = sp.GetService <IVariableProvider>();

            var variables = variableProvider.GetVariablesFor(semanticVersion, config, false);

            buildServer.WithPropertyFile(file);

            buildServer.WriteIntegration(writes.Add, variables);

            writes[1].ShouldBe("1.2.3-beta.1+5");

            File.Exists(file).ShouldBe(true);

            var props = File.ReadAllText(file);

            props.ShouldContain("GitVersion_Major=1");
            props.ShouldContain("GitVersion_Minor=2");
        }