public void GenerateDataNoCustomEnviromentDataReturnsCommitSha() { string sha = "46d8bffca535dd350b0167d0eb58a22d4bf4ea6e"; IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string> { { "TEAMCITY_VERSION", "10.4.5-monsoon" }, { "BUILD_VCS_NUMBER", sha } }); var sut = new TeamCityGitDataResolver(variables, new TestConsole()); var gitData = sut.GenerateData(); AssertNotNull(gitData !); Assert.True(gitData.Value.IsItem2); Assert.Equal(sha, gitData.Value.Item2.Value); }
public void GenerateDataCustomEnviromentDataReturnsGitData() { string sha = "46d8bffca535dd350b0167d0eb58a22d4bf4ea6e"; string branch = "master"; IEnvironmentVariables variables = new TestEnvironmentVariables(new Dictionary <string, string> { { "TEAMCITY_VERSION", "10.4.5-monsoon" }, { "TEAMCITY_BUILD_BRANCH", branch }, { "TEAMCITY_BUILD_COMMIT", sha } }); var sut = new TeamCityGitDataResolver(variables, new TestConsole()); var gitData = sut.GenerateData(); AssertNotNull(gitData !); Assert.True(gitData.Value.IsItem1); Assert.Equal(branch, gitData.Value.Item1.Branch); AssertNotNull(gitData.Value.Item1.Head !); Assert.Equal(sha, gitData.Value.Item1.Head.Id); }