public void Invoke_Equals_OnSameReferences_ShouldReturnTrue() { var status1 = new JenkinsJobStatus { IsRunning = IsRunning, State = State }; var status2 = status1; Assert.AreEqual(status1, status2); }
private void SetStatus(JenkinsJobStatus newStatus) { Status = newStatus; try { StatusChanged?.Invoke(); } catch {} }
public void Invoke_Equals_OnDifferentReferences_WithDifferentRunning_ShouldReturnFalse() { var status1 = new JenkinsJobStatus { IsRunning = IsRunning, State = State }; var status2 = new JenkinsJobStatus { IsRunning = !IsRunning, State = State }; Assert.AreNotEqual(status1, status2); }
public void Invoke_Equals_OnDifferentReferences_WithSameAttributes_ShouldReturnTrue() { var status1 = new JenkinsJobStatus { IsRunning = IsRunning, State = State }; var status2 = new JenkinsJobStatus { IsRunning = IsRunning, State = State }; Assert.AreEqual(status1, status2); }
public void Invoke_Equals_OnDifferentReferences_WithDifferentState_ShouldReturnFalse() { var state2 = (JenkinsJobState)((((int)State) + 1) % 6); var status1 = new JenkinsJobStatus { IsRunning = IsRunning, State = State }; var status2 = new JenkinsJobStatus { IsRunning = IsRunning, State = state2 }; Assert.AreNotEqual(status1, status2); }
private void SetStatus(JenkinsJobStatus newStatus) { Status = newStatus; try { StatusChanged?.Invoke(); } catch { //预防订阅时间中出错,吃掉异常 } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var status = new JenkinsJobStatus(); if (reader.TokenType != JsonToken.Null) { var colorStr = serializer.Deserialize <string>(reader); switch (colorStr) { case "blue": case "blue_anime": status.State = JenkinsJobState.Success; break; case "red": case "red_anime": status.State = JenkinsJobState.Failed; break; case "yellow": case "yellow_anime": status.State = JenkinsJobState.Unstable; break; case "disabled": case "disabled_anime": status.State = JenkinsJobState.Disabled; break; case "aborted": case "aborted_anime": status.State = JenkinsJobState.Aborted; break; default: status.State = JenkinsJobState.None; break; } status.IsRunning = colorStr.EndsWith("_anime"); } return(status); }
private JobStatus ConvertJenkinsJobToJob(JenkinsJobStatus status) { switch (status.State) { case JenkinsJobState.Aborted: return(JobStatus.Aborted); case JenkinsJobState.Disabled: return(JobStatus.Disabled); case JenkinsJobState.Failed: return(JobStatus.Failed); case JenkinsJobState.Success: return(JobStatus.Success); case JenkinsJobState.Unstable: return(JobStatus.Unstable); default: return(JobStatus.None); } }
/// <summary> /// Equalses the specified other. /// </summary> /// <param name="other">The other.</param> /// <returns></returns> protected bool Equals(JenkinsJobStatus other) { return(!ReferenceEquals(null, other) && this.state == other.state && this.isRunning.Equals(other.isRunning)); }