/// <summary> /// Initializes a new instance of the <see cref="BuildNotification"/> class. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <param name="projectId">The project id.</param> /// <param name="buildConfigId">The build config id.</param> /// <param name="recipients">The recipients.</param> public BuildNotification(BuildServerNotificationType notificationType, string projectId, string buildConfigId, string[] recipients) { if (!Parser.IsBuildNotification(notificationType)) { throw new InvalidBuildServerNotificationException(string.Format("{0} is not valid for a {1}", notificationType, typeof(BuildNotification))); } this.Type = notificationType; this.ProjectId = projectId; this.BuildConfigId = buildConfigId; this.Recipients = recipients; }
/// <summary> /// Initializes a new instance of the <see cref="ResponsibilityNotification"/> class. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <param name="projectId">The project id.</param> /// <param name="buildConfigId">The build config id.</param> /// <param name="username">The username.</param> /// <param name="state">The state.</param> public ResponsibilityNotification(BuildServerNotificationType notificationType, string projectId, string buildConfigId, string username, string state) { if (!Parser.IsResponsibilityNotification(notificationType)) { throw new InvalidBuildServerNotificationException(string.Format("{0} is not valid for a {1}", notificationType, typeof(ResponsibilityNotification))); } this.Type = notificationType; this.ProjectId = projectId; this.BuildConfigId = buildConfigId; this.Recipient = username; this.State = state; }
/// <summary> /// Determines whether to cancel the need for the user's attention. Basically, only if /// the build is successful, we'll cancel the current attention setting or the responsibility /// gets assigned to someone else the other <see cref="IsAttentionRequired(BuildServerNotificationType, string)"/>. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <returns> /// <c>true</c> if attention must be cancelled; otherwise, <c>false</c>. /// </returns> public static bool IsNoAttentionRequired(BuildServerNotificationType notificationType) { return notificationType == BuildServerNotificationType.BuildSuccessful; }
/// <summary> /// Determines whether attention is required for the specified notification type. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <param name="state">The state.</param> /// <returns> /// <c>true</c> if attention is required for the specified notification type; otherwise, <c>false</c>. /// </returns> public static bool IsAttentionRequired(BuildServerNotificationType notificationType, string state) { return (notificationType == BuildServerNotificationType.BuildResponsibilityAssigned || notificationType == BuildServerNotificationType.TestResponsibilityAssigned) && (state == BuildServerResponsibilityState.Taken); }
/// <summary> /// Determines whether attention is required for the specified notification type. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <returns> /// <c>true</c> if attention is required for the specified notification type; otherwise, <c>false</c>. /// </returns> public static bool IsAttentionRequired(BuildServerNotificationType notificationType) { return notificationType == BuildServerNotificationType.BuildFailed || notificationType == BuildServerNotificationType.BuildFailedToStart || notificationType == BuildServerNotificationType.BuildFailing || notificationType == BuildServerNotificationType.BuildHanging; }
/// <summary> /// Determines whether the specified notification type is for an active build. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <returns> /// <c>true</c> if the specified notification type is for an active build; otherwise, <c>false</c>. /// </returns> public static bool IsActiveBuild(BuildServerNotificationType notificationType) { return notificationType == BuildServerNotificationType.BuildBuilding || notificationType == BuildServerNotificationType.BuildHanging || notificationType == BuildServerNotificationType.BuildFailing; }
/// <summary> /// Determines whether the specified notification type is a responsibility notification. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <returns> /// <c>true</c> if the specified notification type is a responsibility notification; otherwise, <c>false</c>. /// </returns> public static bool IsResponsibilityNotification(BuildServerNotificationType notificationType) { return notificationType == BuildServerNotificationType.BuildResponsibilityAssigned || notificationType == BuildServerNotificationType.TestResponsibilityAssigned; }
/// <summary> /// Determines whether the specified notification type is a build notification. /// </summary> /// <param name="notificationType">Type of the notification.</param> /// <returns> /// <c>true</c> if the specified notification type is a build notification; otherwise, <c>false</c>. /// </returns> public static bool IsBuildNotification(BuildServerNotificationType notificationType) { return notificationType == BuildServerNotificationType.BuildBuilding || notificationType == BuildServerNotificationType.BuildFailed || notificationType == BuildServerNotificationType.BuildFailedToStart || notificationType == BuildServerNotificationType.BuildHanging || notificationType == BuildServerNotificationType.BuildSuccessful || notificationType == BuildServerNotificationType.BuildFailing; }