public void should_fail_if_build_status_unknown() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1"); connection.SetBuildStatus("BuildName1", "XXX"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1" }; var monitor = new TeamCityMonitor(connection, configuration); Assert.Throws<NotSupportedException>(monitor.BeginMonitoring); }
public void should_set_status_failed_if_single_build_fails() { var buildStatus = BuildState.Unknown; var connection = new MockTeamCityConnection("ProjectName1:BuildName1"); connection.SetBuildStatus("BuildName1", "FAILURE"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.StatusChanged += (s, e) => buildStatus = e.NewState; monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Failed, buildStatus); }
public void should_return_success_if_build_is_successful() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1"); connection.SetBuildStatus("BuildName1", "SUCCESS"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Succeeded, monitor.CurrentState); }
public void should_return_running_if_any_build_running_when_others_succeeded() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1;ProjectName2:BuildName2"); connection.SetBuildStatus("BuildName1", "SUCCESS", true); connection.SetBuildStatus("BuildName2", "SUCCESS"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1;ProjectName2:BuildName2" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Running, monitor.CurrentState); }
public void should_return_failure_if_build_is_still_running_but_has_failed() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1"); connection.SetBuildStatus("BuildName1", "FAILURE", true); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Failed, monitor.CurrentState); }
public void should_return_failure_if_any_build_failed() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1;ProjectName2:BuildName2"); connection.SetBuildStatus("BuildName1", "SUCCESS"); connection.SetBuildStatus("BuildName2", "FAILURE"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1;ProjectName2:BuildName2" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Failed, monitor.CurrentState); }
public void should_return_error_if_all_builds_are_in_error() { var connection = new MockTeamCityConnection("ProjectName1:BuildName1;ProjectName2:BuildName2"); connection.SetBuildStatus("BuildName1", "ERROR"); connection.SetBuildStatus("BuildName2", "ERROR"); var configuration = new TeamCityConfiguration { BuildsToMonitor = "ProjectName1:BuildName1;ProjectName2:BuildName2" }; var monitor = new TeamCityMonitor(connection, configuration); monitor.BeginMonitoring(); Assert.AreEqual(BuildState.Error, monitor.CurrentState); }