public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, Dictionary <string, string> headers, string body, BodyFormat bodyFormat, object expectations) { var propertyReader = new PropertyReader(); var expectedProps = propertyReader.RouteValues(expectations); ApiRouteAssert.HasRoute(config, url, httpMethod, headers, body, bodyFormat, expectedProps); }
public static void HasRoute(RouteCollection routes, string url, string body, BodyFormat bodyFormat, object expectations) { var propertyReader = new PropertyReader(); var expectedRouteValues = propertyReader.RouteValues(expectations); WebRouteAssert.HasRoute(routes, HttpMethod.Get, url, body, bodyFormat, expectedRouteValues); }
public void ShouldReadToRouteValues() { var propsIn = new { Foo = 1, Bar = "Two" }; var routeValues = reader.RouteValues(propsIn); Assert.That(routeValues, Is.Not.Null); Assert.That(routeValues.Controller, Is.Null); Assert.That(routeValues.Action, Is.Null); Assert.That(routeValues.Area, Is.Null); Assert.That(routeValues.Values.Count, Is.EqualTo(2)); Assert.That(routeValues.GetRouteValue("Foo", RouteValueOrigin.Unknown).Value, Is.EqualTo(1)); Assert.That(routeValues.GetRouteValue("Bar", RouteValueOrigin.Unknown).Value, Is.EqualTo("Two")); }
public static void GeneratesActionUrl(RouteCollection routes, string expectedUrl, object fromProps, HttpMethod httpMethod = null, string appPath = "/", string requestBody = null) { if (httpMethod == null) { httpMethod = HttpMethod.Get; } var propertyReader = new PropertyReader(); var expectedRouteValues = propertyReader.RouteValues(fromProps); WebRouteAssert.GeneratesActionUrl(routes, httpMethod, expectedUrl, expectedRouteValues, appPath, requestBody); }