public void GetRouteData_ShouldNotReturnData_WhenNameIsOfInvalidController() { var handler = new ApiRoute("test", null, Assembly.GetAssembly(typeof(ApiRouteTests))); var context = new MockHttpContext { Request = new MockHttpRequest { RawUrl = "/test/bad" } }; Assert.IsNull(handler.GetRouteData(context)); }
public void GetRouteData_ShouldReturnDataWithController_WhenNameIsOfValidController() { var handler = new ApiRoute("test", null, Assembly.GetAssembly(typeof(ApiRouteTests))); var context = new MockHttpContext { Request = new MockHttpRequest { RawUrl = "/test/valid" } }; var type = typeof(ValidController); Assert.AreEqual(type.FullName, handler.GetRouteData(context).Controller.GetType().FullName); }
public void Ctor_ShouldSetPrefix() { var handler = new ApiRoute("/test/", null, Assembly.GetAssembly(typeof(ApiRouteTests))); Assert.AreEqual("/test/", handler.UrlPrefix); }
public void Ctor_ShouldAppendAndPrependSlashToPrefix() { var handler = new ApiRoute("test", null, Assembly.GetAssembly(typeof(ApiRouteTests))); Assert.AreEqual("/test/", handler.UrlPrefix); }