/// <inheritdoc /> public IApiRoutes AddRoute(string route, ApiRouteHandler <object> handler, bool isPublic = false) => AddRoute <object>(route, handler, isPublic);
/// <inheritdoc /> public IApiRoutes AddRoute <TRequest>(string route, ApiRouteHandler <TRequest> handler, bool isPublic = false) where TRequest : class => AddGeneralRoute(route, handler, isPublic);
public void Handle_ShouldNotReturnResult_WhenMethodIsNotSupported() { var handler = new ApiRouteHandler(); var result = handler.Handle(new MockHttpContext { Request = new MockHttpRequest { HttpMethod = "BLAH" } }, new RouteData { Controller = new ValidController() }); Assert.IsNull(result); }
public void Handle_ShouldReturnResult_WhenControllerIsApiController() { var handler = new ApiRouteHandler(); var result = handler.Handle(new MockHttpContext { Request = new MockHttpRequest { HttpMethod = "GET" } }, new RouteData { Controller = new ValidController() }); Assert.IsNotNull(result); }
public void Handle_ShouldNotReturnResult_WhenControllerIsNull() { var handler = new ApiRouteHandler(); var result = handler.Handle(null, new RouteData() { Controller = null }); Assert.IsNull(result); }