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); }