public void Can_match_lowercase_http_method() { var restPath = new RestPath(typeof(ComplexType), "/Complex/{Id}/{Name}/Unique/{UniqueId}", "PUT"); var withPathInfoParts = RestPath.GetPathPartsForMatching("/complex/5/Is Alive/unique/4583B364-BBDC-427F-A289-C2923DEBD547"); Assert.That(restPath.IsMatch("put", withPathInfoParts)); }
private static void AssertNoMatch(string definitionPath, string requestPath) { var restPath = new RestPath(typeof(SlugRequest), definitionPath); var requestTestPath = RestPath.GetPathPartsForMatching(requestPath); Assert.That(restPath.IsMatch("GET", requestTestPath), Is.False); }
private static void AssertMatch(string definitionPath, string requestPath, string firstMatchHashKey, BbcMusicRequest expectedRequest) { var restPath = new RestPath(typeof(BbcMusicRequest), definitionPath); var reqestTestPath = RestPath.GetPathPartsForMatching(requestPath); Assert.That(restPath.IsMatch("GET", reqestTestPath), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); var actualRequest = restPath.CreateRequest(requestPath) as BbcMusicRequest; Assert.That(actualRequest, Is.Not.Null); Assert.That(actualRequest.mbz_guid, Is.EqualTo(expectedRequest.mbz_guid)); Assert.That(actualRequest.release_type, Is.EqualTo(expectedRequest.release_type)); Assert.That(actualRequest.content_type, Is.EqualTo(expectedRequest.content_type)); }
private static void AssertMatch(string definitionPath, string requestPath, string firstMatchHashKey, SlugRequest expectedRequest, int expectedScore) { var restPath = new RestPath(typeof(SlugRequest), definitionPath); var requestTestPath = RestPath.GetPathPartsForMatching(requestPath); Assert.That(restPath.IsMatch("GET", requestTestPath), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); var actualRequest = restPath.CreateRequest(requestPath) as SlugRequest; Assert.That(actualRequest, Is.Not.Null); Assert.That(actualRequest.Slug, Is.EqualTo(expectedRequest.Slug)); Assert.That(actualRequest.Version, Is.EqualTo(expectedRequest.Version)); Assert.That(actualRequest.Options, Is.EqualTo(expectedRequest.Options)); Assert.That(restPath.MatchScore("GET", requestTestPath), Is.EqualTo(expectedScore)); }
private static void AssertMatch(string definitionPath, string requestPath, string firstMatchHashKey, RackSpaceRequest expectedRequest) { var restPath = new RestPath(typeof(RackSpaceRequest), definitionPath); var reqestTestPath = RestPath.GetPathPartsForMatching(requestPath); Assert.That(restPath.IsMatch("GET", reqestTestPath), Is.True); Assert.That(firstMatchHashKey, Is.EqualTo(restPath.FirstMatchHashKey)); var actualRequest = restPath.CreateRequest(requestPath) as RackSpaceRequest; Assert.That(actualRequest, Is.Not.Null); Assert.That(actualRequest.version, Is.EqualTo(expectedRequest.version)); Assert.That(actualRequest.id, Is.EqualTo(expectedRequest.id)); Assert.That(actualRequest.resource_type, Is.EqualTo(expectedRequest.resource_type)); Assert.That(actualRequest.action, Is.EqualTo(expectedRequest.action)); }
public void Can_match_lowercase_http_method() { var restPath = new RestPath(typeof (ComplexType), "/Complex/{Id}/{Name}/Unique/{UniqueId}", "PUT"); var withPathInfoParts = RestPath.GetPathPartsForMatching("/complex/5/Is Alive/unique/4583B364-BBDC-427F-A289-C2923DEBD547"); Assert.That(restPath.IsMatch("put", withPathInfoParts)); }