public void Should_Throw_If_Writer_Is_Null()
            {
                // Given
                var fixture = new TeamCityFixture();

                // When
                var result = Record.Exception(() => new TeamCityProvider(fixture.Environment, fixture.FileSystem, null));

                // Then
                AssertEx.IsArgumentNullException(result, "writer");
            }
Exemple #2
0
            public void Should_Throw_If_Log_Is_Null()
            {
                // Given
                var fixture = new TeamCityFixture();

                // When
                var result = Record.Exception(() => new TeamCityProvider(fixture.Environment, null));

                // Then
                Assert.IsArgumentNullException(result, "log");
            }
            public void Should_Return_False_If_Not_Running_On_TeamCity()
            {
                // Given
                var fixture  = new TeamCityFixture();
                var teamCity = fixture.CreateTeamCityService();

                // When
                var result = teamCity.IsRunningOnTeamCity;

                // Then
                Assert.False(result);
            }
            public void BuildProblem_Should_Write_To_The_Log_Correctly(string description, string identity, string expected)
            {
                // Given
                var fixture  = new TeamCityFixture();
                var teamCity = fixture.CreateTeamCityService();

                // When
                teamCity.BuildProblem(description, identity);

                // Then
                Assert.Equal($"##teamcity[buildProblem {expected}]" + Environment.NewLine,
                             fixture.Writer.GetOutput());
            }
            public void SetParameter_Should_Write_To_The_Log_Correctly()
            {
                // Given
                var fixture  = new TeamCityFixture();
                var teamCity = fixture.CreateTeamCityService();

                // When
                teamCity.SetParameter("internal.artifactVersion", "1.2.3.4");

                // Then
                Assert.Equal("##teamcity[setParameter name='internal.artifactVersion' value='1.2.3.4']" + Environment.NewLine,
                             fixture.Writer.GetOutput());
            }
            public void Should_Use_Bundled_DotCover_If_ToolPath_Is_Null()
            {
                // Given
                var fixture = new TeamCityFixture();

                fixture.IsRunningOnTeamCity();
                var teamCity = fixture.CreateTeamCityService();
                var snapshot = new FilePath("/path/to/result.dcvr");

                // When
                teamCity.ImportDotCoverCoverage(snapshot);

                // Then
                Assert.Equal("##teamcity[dotNetCoverage ]" + Environment.NewLine +
                             "##teamcity[importData type='dotNetCoverage' tool='dotcover' path='/path/to/result.dcvr']" + Environment.NewLine,
                             fixture.Writer.GetOutput());
            }
Exemple #7
0
            public void Should_Use_Provided_DotCover_If_ToolPath_Is_Not_Null()
            {
                // Given
                var fixture = new TeamCityFixture();

                fixture.IsRunningOnTeamCity();
                var teamCity     = fixture.CreateTeamCityService();
                var snapshot     = new FilePath("/path/to/result.dcvr");
                var dotCoverHome = new DirectoryPath("/path/to/dotcover_home");

                // When
                teamCity.ImportDotCoverCoverage(snapshot, dotCoverHome);

                // Then
                Assert.Equal("##teamcity[dotNetCoverage dotcover_home='/path/to/dotcover_home']" + Environment.NewLine +
                             "##teamcity[importData type='dotNetCoverage' tool='dotcover' path='/path/to/result.dcvr']" + Environment.NewLine,
                             fixture.Log.AggregateLogMessages());
            }