/// <summary> /// Find the first match in the given collection. /// </summary> /// <param name="simulations">The collection of simulations. Can be null or empty. </param> /// <param name="path"></param> /// <param name="headers"></param> /// <returns></returns> public Simulation Match(SimulationCollection simulations, System.Net.Http.HttpMethod method, string path, string query, IEnumerable<Header> headers) { if (null == simulations) return null; if (simulations.Count() == 0) return null; var matches = simulations.Where(f => Matches(f, method, path, query, headers) == true); var match = matches.FirstOrDefault(); return match; }
/// <summary> /// Returns all matches in the order in which they were added. /// </summary> /// <param name="simulations">The collection of simulations. Can be null or empty. </param> /// <param name="content"></param> /// <param name="method"></param> /// <param name="path"></param> /// <param name="headers"></param> /// <returns></returns> public IEnumerable<Simulation> Matches(SimulationCollection simulations, HttpContent content, System.Net.Http.HttpMethod method, string path, string query, IEnumerable<Header> headers) { IEnumerable<Simulation> matches = new List<Simulation>(); if (null == simulations) return matches; if (simulations.Count() == 0) return matches; matches = simulations.Where(f => Matches(f, content, method, path, query, headers) == true); return matches; }