public void ByUserShouldNotResolveWithoutUsername() { MyWebApi .Routes() .ShouldMap("api/Comments/ByUser") .WithHttpMethod(HttpMethod.Get) .ToInvalidModelState(); }
public void ToShouldThrowExceptionWithNotResolvedRoute() { MyWebApi .Routes() .ShouldMap("api/Route/GetMethod") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.GetMethod()); }
public void NonExistendRouteShouldThrowProperErrorException() { MyWebApi .Routes() .ShouldMap("/Route/PostMethodWithModel") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.VoidAction()); }
public void TestRouteToNotMapPutMethodToBugsWithoutId() { MyWebApi .Routes() .ShouldMap("api/bugs") .WithHttpMethod(HttpMethod.Put) .ToNotAllowedMethod(); }
public void ToShouldResolveCorrectlyWithFullQueryString() { MyWebApi .Routes() .ShouldMap("api/Route/QueryString?first=test&second=5") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.QueryString("test", 5)); }
public void GetAllShouldThrowExceptionWithRouteDoesNotExistWhenControllerIsInvalid() { MyWebApi .Routes() .ShouldMap(GET_PATH) .WithHttpMethod(HttpMethod.Get) .To <AircraftsController>(a => a.All()); }
public void ImagesGetShouldMapToCorrectMethod() { MyWebApi .Routes() .ShouldMap("api/Images") .WithHttpMethod(HttpMethod.Get) .To <ImagesController>(c => c.Get()); }
public void ToShouldResolveCorrectyWithNullJsonContent() { MyWebApi .Routes() .ShouldMap("api/Route/PostMethodWithModel") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.PostMethodWithModel(null)); }
public void WithHttpRequestMessageShouldWorkCorrectly() { MyWebApi .Routes() .ShouldMap(new HttpRequestMessage(HttpMethod.Post, "api/NoParameterlessConstructor/OkAction")) .WithHttpMethod(HttpMethod.Post) .To <NoParameterlessConstructorController>(c => c.OkAction()); }
public void ToShouldResolveCorrectlyWithRoutePrefixAndRouteAttribute() { MyWebApi .Routes() .ShouldMap("api/Routes/Test") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.WithRouteAttribute()); }
public void ToShouldResolveCorrectlyWithIgnoredParameter() { MyWebApi .Routes() .ShouldMap("api/Route/WithParameter/5") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.WithParameter(With.Any <int>())); }
public void ToShouldResolveCorrectControllerAndActionWithActionNameAttribute() { MyWebApi .Routes() .ShouldMap("api/Route/ChangedActionName") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.WithActionNameAttribute()); }
public void ToShouldResolveCorrectControllerAndActionWithUriLocation() { MyWebApi .Routes() .ShouldMap(new Uri("api/NoParameterlessConstructor/OkAction", UriKind.RelativeOrAbsolute)) .WithHttpMethod(HttpMethod.Post) .To <NoParameterlessConstructorController>(c => c.OkAction()); }
public void ToControllerTypeShouldThrowExceptionWithIncorrectControllerType() { MyWebApi .Routes() .ShouldMap("api/NoParameterlessConstructor/OkAction") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(); }
public void TestDeleteCategoryShouldMapCorrectly() { MyWebApi .Routes() .ShouldMap("api/categories/1") .WithHttpMethod(HttpMethod.Delete) .To <CategoriesController>(c => c.Delete(1)); }
public void ToNotAllowedMethodShouldWorkCorrectly() { MyWebApi .Routes() .ShouldMap("api/Route/GetMethod") .WithHttpMethod("POST") .ToNotAllowedMethod(); }
public void GetAllShouldThrowExceptionWithRouteDoesNotExistWhenActionIsInvalid() { MyWebApi .Routes() .ShouldMap(GET_PATH_WITH_INVALID_ACTION) .WithHttpMethod(HttpMethod.Get) .To <AirportsController>(a => a.All()); }
public void ToNotAllowedMethodShouldThrowExceptionWithWrongMethod() { MyWebApi .Routes() .ShouldMap("api/Route/GetMethod") .WithHttpMethod("GET") .ToNotAllowedMethod(); }
public void GetAllShouldMapCorrectAction() { MyWebApi .Routes() .ShouldMap(GET_PATH) .WithHttpMethod(HttpMethod.Get) .To <AirportsController>(a => a.All()); }
public void ToNotAllowedMethodShouldThrowExceptionWithUnresolvedRoute() { MyWebApi .Routes() .ShouldMap("api/Route/SameAction") .WithHttpMethod("POST") .ToNotAllowedMethod(); }
public void ImageDeletionShouldMapToCorrectMethod() { MyWebApi .Routes() .ShouldMap("api/Images/3") .WithHttpMethod(HttpMethod.Delete) .To <ImagesController>(c => c.Delete(3)); }
public void ToShouldResolveCorrectControllerAndAction() { MyWebApi .Routes() .ShouldMap("api/NoParameterlessConstructor/OkAction") .WithHttpMethod(HttpMethod.Post) .To <NoParameterlessConstructorController>(c => c.OkAction()); }
public void ToShouldResolveCorrectlyWithParameterAndQueryString() { MyWebApi .Routes() .ShouldMap("api/Route/WithParameterAndQueryString/5?value=test") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.WithParameterAndQueryString(5, "test")); }
public void WithRequestHeaderMultipleValuesShouldWorkCorrectly() { MyWebApi .Routes() .ShouldMap("api/HeaderRoute") .WithRequestHeader(CustomHeader, new[] { CustomHeaderValue }) .To <RouteController>(c => c.HeaderRoute()); }
public void ToShouldResolveCorrectlyWithVoidAction() { MyWebApi .Routes() .ShouldMap("api/Route/VoidAction") .WithHttpMethod(HttpMethod.Post) .To <RouteController>(c => c.VoidAction()); }
public void ToActionShouldThrowExceptionWithIncorrectAction() { MyWebApi .Routes() .ShouldMap("api/NoParameterlessConstructor/OkAction") .WithHttpMethod(HttpMethod.Post) .ToAction("Invalid"); }
public void WithCustomConfigurationShouldWorkCorrectly() { MyWebApi .Routes(TestObjectFactory.GetHttpConfigurationWithRoutes()) .ShouldMap("api/NoParameterlessConstructor/OkAction") .WithHttpMethod(HttpMethod.Post) .To <NoParameterlessConstructorController>(c => c.OkAction()); }
public void ToControllerShouldResolveCorrectController() { MyWebApi .Routes() .ShouldMap("api/NoParameterlessConstructor/OkAction") .WithHttpMethod(HttpMethod.Post) .ToController("NoParameterlessConstructor"); }
public void ToShouldThrowExceptionWithMoreParameters() { MyWebApi .Routes() .ShouldMap("api/Route/GetMethod") .WithHttpMethod(HttpMethod.Get) .To <RouteController>(c => c.GetMethod(1)); }
public void DeleteShouldBeMappedCorrectly() { MyWebApi .Routes() .ShouldMap("/api/Categories/1") .WithHttpMethod(HttpMethod.Delete) .To <CategoriesController>(c => c.DeleteCategory(1)); }