public void GetWorksForValuesWithWhitespace() { var collection = new NameValueCollection(); collection.Add("somekey", "the value\t with WHITESPACE"); HttpContextServiceHost.GetQueryStringItem("somekey", collection).Should().Be("the value\t with WHITESPACE"); }
public void GetDoesNotCareAboutSpecialDollarCharacter() { var collection = new NameValueCollection(); collection.Add("$isreserved$butwedontcarehere", "thevalue"); HttpContextServiceHost.GetQueryStringItem("$isreserved$butwedontcarehere", collection).Should().Be("thevalue"); }
public void GetWillTrimExcessWhiteSpaceOffKey() { var collection = new NameValueCollection(); collection.Add("\tsomekey \n\r", "thevalue"); HttpContextServiceHost.GetQueryStringItem("somekey", collection).Should().Be("thevalue"); }
public void GetPresentKeyShouldReturnItsValue() { var collection = new NameValueCollection(); collection.Add("somekey", "thevalue"); HttpContextServiceHost.GetQueryStringItem("somekey", collection).Should().Be("thevalue"); }
public void VerifyDoesNotAllowDollarLinks() { var collection = new NameValueCollection(); collection.Add("$ref", "value"); Action action = () => HttpContextServiceHost.VerifyQueryParameters(collection); action.ShouldThrow <DataServiceException>().WithMessage("The query parameter '$ref' begins with a system-reserved '$' character but is not recognized."); }
public void VerifyDoesNotAllowRepeatFormat() { var collection = new NameValueCollection(); collection.Add("$format", "json"); collection.Add("$format", "atom"); Action action = () => HttpContextServiceHost.VerifyQueryParameters(collection); action.ShouldThrow <DataServiceException>().WithMessage("Query parameter '$format' is specified, but it should be specified exactly once."); }
public void VerifyDoesNotAllowControlInfo() { // $controlinfo was briefly used for controlling how much metadata a client wanted // in JSON-Light payloads. It was removed and replaced with a parameter in the media type. var collection = new NameValueCollection(); collection.Add("$controlinfo", "value"); Action action = () => HttpContextServiceHost.VerifyQueryParameters(collection); action.ShouldThrow <DataServiceException>().WithMessage("The query parameter '$controlinfo' begins with a system-reserved '$' character but is not recognized."); }
public void VerifyAllowsWellKnownDollarQueryOptions() { var collection = new NameValueCollection(); collection.Add("$select", "value"); collection.Add("$filter", "value"); collection.Add("$top", "value"); collection.Add("$skip", "value"); collection.Add("$expand", "value"); collection.Add("$orderby", "value"); collection.Add("$count", "value"); collection.Add("$format", "value"); collection.Add("$callback", "value"); Action action = () => HttpContextServiceHost.VerifyQueryParameters(collection); action.ShouldNotThrow(); }
public void GetMissingKeyShouldReturnNull() { HttpContextServiceHost.GetQueryStringItem("missing_item", new NameValueCollection()).Should().Be(null); }