public override bool Equals(object obj) { ApiSpecSampleKey otherKey = obj as ApiSpecSampleKey; if (otherKey == null) { return(false); } return(String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) && String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) && (MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) && ParameterType == otherKey.ParameterType && SampleDirection == otherKey.SampleDirection && ParameterNames.SetEquals(otherKey.ParameterNames)); }
private IEnumerable <KeyValuePair <ApiSpecSampleKey, object> > GetAllActionSamples(string controllerName, string actionName, IEnumerable <string> parameterNames, SampleDirection sampleDirection) { HashSet <string> parameterNamesSet = new HashSet <string>(parameterNames, StringComparer.OrdinalIgnoreCase); foreach (var sample in ActionSamples) { ApiSpecSampleKey sampleKey = sample.Key; if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) && String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) && (sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) && sampleDirection == sampleKey.SampleDirection) { yield return(sample); } } }