public void Should_Return_Value_From_Properties() { // Given var fixture = new TeamCityInfoFixture(); fixture.SetBuildPropertiesContent(Properties.Resources.TeamCity_Build_Properties_Xml); fixture.SetConfigPropertiesContent(Properties.Resources.TeamCity_Config_Properties_Xml); var info = fixture.CreateBuildInfo(); // When var result = info.VcsBranchName; // Then Assert.Equal("refs/pull/5/merge", result); }
public void Should_Return_Empty_When_Runner_Properties_File_Not_Created() { // Given var fixture = new TeamCityInfoFixture(); fixture.SetBuildPropertiesContent(Properties.Resources.TeamCity_Build_Properties_Xml); var info = fixture.CreateBuildInfo(); // When var buildProperties = info.BuildProperties; var runnerProperties = info.RunnerProperties; // Then Assert.NotEmpty(buildProperties); Assert.Empty(runnerProperties); }
public void Should_Return_Correct_Value(string value, int?expected) { // Given var fixture = new TeamCityInfoFixture(); fixture.SetGitBranch(value); fixture.SetBuildPropertiesContent(Properties.Resources.TeamCity_Build_Properties_Xml); fixture.SetConfigPropertiesContent(Properties.Resources.TeamCity_Config_Properties_Xml); var info = fixture.CreatePullRequestInfo(); // When var result = info.Number; // Then Assert.Equal(expected, result); }
public void Should_Return_Runner_Values_When_Files_Exist() { // Given var fixture = new TeamCityInfoFixture(); fixture.SetBuildPropertiesContent(Properties.Resources.TeamCity_Build_Properties_Xml); fixture.SetRunnerPropertiesContent(Properties.Resources.TeamCity_Runner_Properties_Xml); var info = fixture.CreateBuildInfo(); // When var buildProperties = info.BuildProperties; var runnerProperties = info.RunnerProperties; // Then Assert.NotEmpty(buildProperties); Assert.NotEmpty(runnerProperties); Assert.Single(runnerProperties); Assert.Equal("run.cmd", runnerProperties["command.executable"]); }
public void Should_Return_Config_Values_When_Files_Exist() { // Given var fixture = new TeamCityInfoFixture(); fixture.SetBuildPropertiesContent(Properties.Resources.TeamCity_Build_Properties_Xml); fixture.SetConfigPropertiesContent(Properties.Resources.TeamCity_Config_Properties_Xml); var info = fixture.CreateBuildInfo(); // When var buildProperties = info.BuildProperties; var configProperties = info.ConfigProperties; // Then Assert.NotEmpty(buildProperties); Assert.NotEmpty(configProperties); Assert.Equal(5, configProperties.Count); Assert.Equal("3246", configProperties["build.number"]); }