I'm writing some unit tests for WebAPI controllers, and one of the aspects that I want to assert is that the parameters match.
I've followed the method used in Filip Wojcieszyn's blog, which is working fine, but I'm now looking to extend its assertions.
I have three actions on a controller (all three of which have been verified through actual use):
[HttpGet]
public IEnumerable<Task> Get()
[HttpGet]
public IEnumerable<Task> Get(string elementType)
[HttpGet]
public Task Get(long id)
And I have the following code
var actionSelector = new ApiControllerActionSelector();
var descriptor = actionSelector.SelectAction(_controllerContext);
return descriptor.GetParameters();
The problem is that when I call descriptor.GetParameters() on the parameterless route it returns a collection containing 1 parameter - the "long id" param.
Can anyone explain why it returns only this and neither of the other two overloads, and if it's possible to obtain the overload possibilities?