コード例 #1
0
            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);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
            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"]);
            }
コード例 #5
0
            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"]);
            }