I have an extension class for Routes. I want to test the updated list of routecollection. This is an extract:
public static void MapMyRoutes(this RouteCollection routes)
{
//do some stuff
routes.MapHttpRoute(null, controllerPath.Path, new { @namespace = controllerPath.Namespace, controller = controllerPath.ControllerName, id = UrlParameter.Optional });
}
I want to unit test this extension, but can't work out how to extract the mapped url from the routecollection:
This is a test:
[TestMethod]
public void TestMapMyRoutesMapsCorrectly()
{
var routes = new RouteCollection();
routes.MapMyRoutes();
foreach (var route in routes)
{
Assert.AreEqual(route.??, "v1/api/myRoute");
}
}
Aucun commentaire:
Enregistrer un commentaire