diff --git a/src/Cake.Common.Tests/Unit/Build/TeamCity/TeamCityProviderTests.cs b/src/Cake.Common.Tests/Unit/Build/TeamCity/TeamCityProviderTests.cs
index 6cd03a6982..a45a8f95a5 100644
--- a/src/Cake.Common.Tests/Unit/Build/TeamCity/TeamCityProviderTests.cs
+++ b/src/Cake.Common.Tests/Unit/Build/TeamCity/TeamCityProviderTests.cs
@@ -109,5 +109,23 @@ public void Should_Use_Provided_DotCover_If_ToolPath_Is_Not_Null()
fixture.Log.AggregateLogMessages());
}
}
+
+ public sealed class TheSetParameterMethod
+ {
+ [Fact]
+ 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.Log.AggregateLogMessages());
+ }
+ }
}
}
diff --git a/src/Cake.Common/Build/TeamCity/TeamCityProvider.cs b/src/Cake.Common/Build/TeamCity/TeamCityProvider.cs
index d659285e47..ffb6edb54a 100644
--- a/src/Cake.Common/Build/TeamCity/TeamCityProvider.cs
+++ b/src/Cake.Common/Build/TeamCity/TeamCityProvider.cs
@@ -237,6 +237,20 @@ public void SetBuildNumber(string buildNumber)
WriteServiceMessage("buildNumber", buildNumber);
}
+ ///
+ /// Tells TeamCity to set a named parameter with a given value
+ ///
+ /// The name of the parameter to set.
+ /// The value to set for the named parameter.
+ public void SetParameter(string parameterName, string parameterValue)
+ {
+ WriteServiceMessage("setParameter", new Dictionary
+ {
+ { "name", parameterName },
+ { "value", parameterValue }
+ });
+ }
+
private void WriteServiceMessage(string messageName, string attributeValue)
{
WriteServiceMessage(messageName, new Dictionary { { " ", attributeValue } });