I've been writing unit tests to verify the validity of MVC routes. For example,
[Route("foo/bar/{id:int}")]
public IHttpActionResult SomeAction(int id)
{
// ...
}
would be valid but
[Route("foo/bar/{id:List<string>}")]
public IHttpActionResult SomeAction(int id)
{
// ...
}
or
[Route("foo/bar/{buzz:int}")]
public IHttpActionResult SomeAction(int id)
{
// ...
}
wouldn't.
But the problem is that I'm getting false negatives because, in the first example above, when I check that {int:id}
in the route matches a parameter in the action method, the name of the type in the parameter is Int32
via reflection and I don't know how to make my test know that Int32
is the same as int
. Is there a way?
Aucun commentaire:
Enregistrer un commentaire