private bool Equals(UserAuthenticated other) { return(string.Equals(this.ServerUrl, other.ServerUrl) && this.JenkinsViewsAreEqual(other) && string.Equals(this.Login, other.Login) && string.Equals(this.ApiToken, other.ApiToken) && this.RefreshDelay == other.RefreshDelay); }
private bool JenkinsViewsAreEqual(UserAuthenticated other) { var viewsAndJobsAreEqual = this.JenkinsViews.Count() == other.JenkinsViews.Count(); var thisList = this.JenkinsViews.ToList(); var otherList = other.JenkinsViews.ToList(); for (var viewIndex = 0; viewIndex < thisList.Count() && viewsAndJobsAreEqual; viewIndex++) { viewsAndJobsAreEqual = thisList[viewIndex].View.Equals(otherList[viewIndex].View) && thisList[viewIndex].Jobs.Count == otherList[viewIndex].Jobs.Count; for (var jobIndex = 0; jobIndex < thisList[viewIndex].Jobs.Count && viewsAndJobsAreEqual; jobIndex++) { if (!string.Equals(thisList[viewIndex].Jobs[jobIndex], otherList[viewIndex].Jobs[jobIndex])) { viewsAndJobsAreEqual = false; } } } return(viewsAndJobsAreEqual); }