private static void Main(string[] args) { #region RemoteTc GetBuildConfigurationParameters(); GetLastSuccessfulBuildsForEachConfigurationWithChanges("Trunk_Ci_FastCi"); PrintEnabledAuthorizedDisconnectedAgents(); PrintAllUsers(); PrintAllUserEmails(); PrintUserDetails(); GetBuildsTriggeredByUser(); DeleteBuildConfigurationParameter(); DeleteProjectParameter(); #endregion #region LocalTc var localTc = new LocalTc(); var buildId = localTc.GetBuildParameter <long>("build.id"); localTc.SetBuildParameter("parameter.name", "value1"); localTc.ChangeBuildStatus(BuildStatus.Success); #endregion Console.ReadKey(); }
public void SetBuildParameter_ParameterNameValue_WriteBuildParameterCalled() { // Arrange var buildParameters = A.Fake<IBuildParameters>(); var localTc = new LocalTc(buildParameters, A.Fake<ITeamCityWriterFactory>()); // Act localTc.SetBuildParameter("parameter.name", "value1"); // Assert A.CallTo(() => buildParameters.SetBuildParameter("parameter.name", "value1")).MustHaveHappened(); }
public void SetBuildParameter_ParameterNameValue_WriteBuildParameterCalled() { // Arrange var buildParameters = A.Fake <IBuildParameters>(); var localTc = new LocalTc(buildParameters, A.Fake <ITeamCityWriterFactory>()); // Act localTc.SetBuildParameter("parameter.name", "value1"); // Assert A.CallTo(() => buildParameters.SetBuildParameter("parameter.name", "value1")).MustHaveHappened(); }
public void IsTeamCityMode_False() { // Arrange var buildParameters = A.Fake <IBuildParameters>(); A.CallTo(() => buildParameters.IsTeamCityMode).Returns(false); var localTc = new LocalTc(buildParameters, A.Fake <ITeamCityWriterFactory>()); // Act var isTeamCityMode = localTc.IsTeamCityMode; // Assert isTeamCityMode.Should().BeFalse(); }
public void IsPersonal_False_False() { // Arrange var buildParameters = A.Fake<IBuildParameters>(); A.CallTo(() => buildParameters.IsPersonal) .Returns(false); var localTc = new LocalTc(buildParameters, A.Fake<ITeamCityWriterFactory>()); // Act bool isPersonal = localTc.IsPersonal; // Assert isPersonal.Should().BeFalse(); }
public void IsPersonal_False_False() { // Arrange var buildParameters = A.Fake <IBuildParameters>(); A.CallTo(() => buildParameters.IsPersonal) .Returns(false); var localTc = new LocalTc(buildParameters, A.Fake <ITeamCityWriterFactory>()); // Act bool isPersonal = localTc.IsPersonal; // Assert isPersonal.Should().BeFalse(); }
public void PublishArtifact_FileNameAndTarget_Published() { // Arrange var teamCityWriterFactory = A.Fake <ITeamCityWriterFactory>(); var teamCityWriter = A.Fake <ITeamCityWriter>(); A.CallTo(() => teamCityWriterFactory.CreateTeamCityWriter()).Returns(teamCityWriter); var localTc = new LocalTc(A.Fake <IBuildParameters>(), teamCityWriterFactory); // Act localTc.PublishArtifact("file.txt", "dir"); // Assert A.CallTo(() => teamCityWriter.PublishArtifact("file.txt => dir")).MustHaveHappened(); }
public void TryGetBuildParameter_ParameterDoesNotExist_False() { // Arrange var buildParameters = A.Fake <IBuildParameters>(); string paramValue; A.CallTo(() => buildParameters.TryGetBuildParameter("param1", out paramValue)).Returns(false); var localTc = new LocalTc(buildParameters, A.Fake <ITeamCityWriterFactory>()); // Act string actualValue; var paramExists = localTc.TryGetBuildParameter("param1", out actualValue); // Assert paramExists.Should().BeFalse(); }
public void TryGetBuildParameter_ParameterExists_True() { // Arrange var buildParameters = A.Fake <IBuildParameters>(); string paramValue; A.CallTo(() => buildParameters.TryGetBuildParameter("param1", out paramValue)).Returns(true) .AssignsOutAndRefParameters("VALUE"); var localTc = new LocalTc(buildParameters, A.Fake <ITeamCityWriterFactory>()); // Act string actualValue; var paramExists = localTc.TryGetBuildParameter("param1", out actualValue); // Assert actualValue.Should().Be("VALUE"); paramExists.Should().BeTrue(); }
public void ChangeBuildStatus_Success_MessageWritten() { // Arrange var teamCityWriter = A.Fake<ITeamCityWriter>(); var teamCityWriterFactory = A.Fake<ITeamCityWriterFactory>(); A.CallTo(() => teamCityWriterFactory.CreateTeamCityWriter()).Returns(teamCityWriter); var localTc = new LocalTc(A.Fake<IBuildParameters>(), teamCityWriterFactory); // Act localTc.ChangeBuildStatus(BuildStatus.Success); // Assert A.CallTo(() => teamCityWriter.WriteRawMessage(A<IServiceMessage>.That.Matches( m => m.Name == "buildStatus" && m.Keys.Single() == "status" && m.GetValue(m.Keys.Single()) == "SUCCESS") )) .MustHaveHappened(); }
public void ChangeBuildStatus_Failure_MessageWritten() { // Arrange var teamCityWriter = A.Fake <ITeamCityWriter>(); var teamCityWriterFactory = A.Fake <ITeamCityWriterFactory>(); A.CallTo(() => teamCityWriterFactory.CreateTeamCityWriter()).Returns(teamCityWriter); var localTc = new LocalTc(A.Fake <IBuildParameters>(), teamCityWriterFactory); // Act localTc.ChangeBuildStatus(BuildStatus.Failure); // Assert A.CallTo(() => teamCityWriter.WriteRawMessage(A <IServiceMessage> .That.Matches( m => m.Name == "buildStatus" && m.Keys.Single() == "status" && m.GetValue(m.Keys.Single()) == "FAILURE"))) .MustHaveHappened(); }
private static void Main(string[] args) { #region RemoteTc PrintEnabledAuthorizedDisconnectedAgents(); PrintAllUsers(); PrintAllUserEmails(); PrintUserDetails(); GetBuildsTriggeredByUser(); DeleteBuildConfigurationParameter(); DeleteProjectParameter(); #endregion #region LocalTc var localTc = new LocalTc(); var buildId = localTc.GetBuildParameter("build.id"); localTc.SetBuildParameter("parameter.name", "value1"); localTc.ChangeBuildStatus(BuildStatus.Success); #endregion Console.ReadKey(); }
public void TryGetBuildParameter_ParameterExists_True() { // Arrange var buildParameters = A.Fake<IBuildParameters>(); string paramValue; A.CallTo(() => buildParameters.TryGetBuildParameter("param1", out paramValue)).Returns(true) .AssignsOutAndRefParameters("VALUE"); var localTc = new LocalTc(buildParameters, A.Fake<ITeamCityWriterFactory>()); // Act string actualValue; var paramExists = localTc.TryGetBuildParameter("param1", out actualValue); // Assert actualValue.Should().Be("VALUE"); paramExists.Should().BeTrue(); }
public void TryGetBuildParameter_ParameterDoesNotExist_False() { // Arrange var buildParameters = A.Fake<IBuildParameters>(); string paramValue; A.CallTo(() => buildParameters.TryGetBuildParameter("param1", out paramValue)).Returns(false); var localTc = new LocalTc(buildParameters, A.Fake<ITeamCityWriterFactory>()); // Act string actualValue; var paramExists = localTc.TryGetBuildParameter("param1", out actualValue); // Assert paramExists.Should().BeFalse(); }
public void IsTeamCityMode_True() { // Arrange var buildParameters = A.Fake<IBuildParameters>(); A.CallTo(() => buildParameters.IsTeamCityMode).Returns(true); var localTc = new LocalTc(buildParameters, A.Fake<ITeamCityWriterFactory>()); // Act var isTeamCityMode = localTc.IsTeamCityMode; // Assert isTeamCityMode.Should().BeTrue(); }