The first line of my ApiController HttpGet action is this
var returnOnlyDefault = (Request.GetQueryNameValuePairs()
.Any(kv => ((kv.Key.ToLower() == "defaultview") && (kv.Value.ToLower() == "true"))));
This looks for a query string value of "defaultview". The code 'works', but i'm having trouble unit testing it.
In my unit test i am doing the following
var controller = new Controllers.ViewsController { Request = new HttpRequestMessage() };
controller.Request.Properties.Add(new KeyValuePair<string, object>("defaultview", "true"));
the request uri is null of course. The test is failing as it doesn't pick up the query string value.