It is currently difficult to unit test actions on ApiController. The primary source of this are non-virtual and non-settable properties. Their getters must be satisfied through convoluted mechanisms.
I recommend these 3 properties be made either virtual or be given a public setter:
1) ApiController.Url
2) ApiController.ModelState
3) ApiController.User
If made virtual, consider making all the properties in ApiController virtual.
Comments: https://aspnetwebstack.codeplex.com/SourceControl/changeset/f2854f5ef3ee46c4152159bb1a06f3fd84b0f0df fixes lots of these issue. Issue 971: https://aspnetwebstack.codeplex.com/workitem/971 and Issue 926 https://aspnetwebstack.codeplex.com/workitem/926 track pending items. so, I am marking this resolved.
I recommend these 3 properties be made either virtual or be given a public setter:
1) ApiController.Url
2) ApiController.ModelState
3) ApiController.User
If made virtual, consider making all the properties in ApiController virtual.
Comments: https://aspnetwebstack.codeplex.com/SourceControl/changeset/f2854f5ef3ee46c4152159bb1a06f3fd84b0f0df fixes lots of these issue. Issue 971: https://aspnetwebstack.codeplex.com/workitem/971 and Issue 926 https://aspnetwebstack.codeplex.com/workitem/926 track pending items. so, I am marking this resolved.