public void NoCallbackQueryOptionShouldDoNothingSpecial() { var host = new DataServiceHostSimulator { RequestHttpMethod = "GET" }; var result = CallbackQueryOptionHandler.HandleCallbackQueryOption(new AstoriaRequestMessage(host), new ODataFormatWithParameters(ODataFormat.Json)); result.Should().BeNull(); }
public void FailIfContentTypeIsMetadata() { var host = new DataServiceHostSimulator { RequestHttpMethod = "GET" }; host.SetQueryStringItem("$callback", "foo"); Action method = () => CallbackQueryOptionHandler.HandleCallbackQueryOption(new AstoriaRequestMessage(host), new ODataFormatWithParameters(ODataFormat.Metadata)); method.ShouldThrow <DataServiceException>().WithMessage(ds.Strings.CallbackQueryOptionHandler_UnsupportedContentType(ODataFormat.Metadata)); }
public void FailIfMethodIsNotGet() { var host = new DataServiceHostSimulator { RequestHttpMethod = "POST" }; host.SetQueryStringItem("$callback", "foo"); Action method = () => CallbackQueryOptionHandler.HandleCallbackQueryOption(new AstoriaRequestMessage(host), new ODataFormatWithParameters(ODataFormat.Json)); method.ShouldThrow <DataServiceException>().WithMessage(ds.Strings.CallbackQueryOptionHandler_GetRequestsOnly); }
public void CallbackQueryOptionShouldWorkIfRaw() { var host = new DataServiceHostSimulator { RequestHttpMethod = "GET" }; host.SetQueryStringItem("$callback", "foo"); var result = CallbackQueryOptionHandler.HandleCallbackQueryOption(new AstoriaRequestMessage(host), new ODataFormatWithParameters(ODataFormat.RawValue)); result.Should().Be("foo"); }
public void IgnoresOtherStuffInHost() { var host = new DataServiceHostSimulator { RequestHttpMethod = "GET" }; host.SetQueryStringItem("$callback", "foo"); host.SetQueryStringItem("$format", "atom"); var result = CallbackQueryOptionHandler.HandleCallbackQueryOption(new AstoriaRequestMessage(host), new ODataFormatWithParameters(ODataFormat.Json)); result.Should().Be("foo"); }