/// <summary> /// Gets all response types that are associated with the endpoint /// </summary> /// <returns></returns> public IEnumerable <ResponseType> GetResponseTypes() { var responseTypes = GetChildren().OfType <ResponseType>(); var groupedResponses = responseTypes.GroupBy(x => x.Status); List <ResponseType> prioritizedResponseTypes = new List <ResponseType>(); foreach (var responseGroup in groupedResponses) { if (responseGroup.Count() > 1) { if (ResponseTypes.Count(x => x.Status == responseGroup.Key) == 1) { var endpointResponse = ResponseTypes.SingleOrDefault(x => x.Status == responseGroup.Key); prioritizedResponseTypes.Add(endpointResponse); } else { //This will fail, we will let it. prioritizedResponseTypes.AddRange(responseGroup); } } else { prioritizedResponseTypes.Add(responseGroup.Single()); } } return(prioritizedResponseTypes.OrderBy(x => x.SortOrder)); }
public override bool Equals(object obj) { var o = obj as GrantingMethod; if (o == null) { return(false); } return(o.GrantTypes.Count() == GrantTypes.Count() && o.GrantTypes.All(g => GrantTypes.Contains(g)) && o.ResponseTypes.Count() == ResponseTypes.Count() && o.ResponseTypes.All(r => ResponseTypes.Contains(r))); }