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_WhenIdSpecified() { var handler = new ApiRoute("test", null, Assembly.GetAssembly(typeof(ApiRouteTests))); var context = new MockHttpContext { Request = new MockHttpRequest { RawUrl = "/test/valid/1" } }; var type = typeof(ValidController); Assert.AreEqual(type.FullName, handler.GetRouteData(context).Controller.GetType().FullName); }