public void UnspecifiedAcceptShouldResolveToDefault_401() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json", ODataVersion.V401); mediaTypeWithFormat.BeJsonLight().HaveDefaultMetadata(); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "metadata")); }
public void UnrecognizedMetadataParameterValueForAcceptShouldFail() { Action acceptUnrecognizedStreamingValue = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=foometadata;", ODataVersion.V4); acceptUnrecognizedStreamingValue .Throws <ODataException>(ErrorStrings.MediaTypeUtils_DidNotFindMatchingMediaType("*", "application/json;odata.metadata=foometadata;")); }
public void UnrecognizedParameterForAcceptShouldFail() { Action acceptUnrecognizedParameter = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;foo=bar", ODataVersion.V4); acceptUnrecognizedParameter .Throws <ODataException>(ErrorStrings.MediaTypeUtils_DidNotFindMatchingMediaType("*", "application/json;odata.metadata=minimal;foo=bar")); }
public void Ieee754CompatibleShouldBeCaseInsensitive() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;ieee754Compatible=TRUE", ODataVersion.V4).BeJsonLight().BeIeee754Compatible(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;ieee754Compatible=False", ODataVersion.V4).BeJsonLight().NotBeIeee754Compatible(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ieee754Compatible=TRUE", ODataVersion.V4).BeJsonLight().BeIeee754Compatible(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ieee754Compatible=False", ODataVersion.V4).BeJsonLight().NotBeIeee754Compatible(); }
public void UnrecognizedIeee754CompatibleParameterValueForAcceptShouldFail() { Action acceptUnrecognizedIeee754CompatibleValue = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;IEEE754Compatible=none", ODataVersion.V4); acceptUnrecognizedIeee754CompatibleValue .Throws <ODataException>(ErrorStrings.MediaTypeUtils_DidNotFindMatchingMediaType("*", "application/json;odata.metadata=minimal;IEEE754Compatible=none")); }
public void UnrecognizedStreamingParameterValueForAcceptShouldFail() { Action acceptUnrecognizedStreamingValue = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=foo", ODataVersion.V4); acceptUnrecognizedStreamingValue .ShouldThrow <ODataException>() #if NETCOREAPP1_0 .WithMessage(ErrorStrings.MediaTypeUtils_DidNotFindMatchingMediaType("*", "application/json;odata.metadata=minimal;odata.streaming=foo"));
public void UnrecognizedStreamingParameterValueForAcceptShouldFail() { Action acceptUnrecognizedStreamingValue = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=foo", ODataVersion.V4); ODataContentTypeException exception = Assert.Throws <ODataContentTypeException>(acceptUnrecognizedStreamingValue); Assert.Contains("do not match any of the acceptable MIME types 'application/json;odata.metadata=minimal;odata.streaming=foo'.", exception.Message); }
public void MetadataAllAcceptShouldSucceed_Without_Prefix() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;metadata=full", ODataVersion.V4); mediaTypeWithFormat.BeJsonLight().HaveFullMetadata(); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "metadata")); Assert.False(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "odata.metadata")); }
public void StreamingAcceptShouldResolveToStreamingResponse_Without_Prefix() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;metadata=minimal;streaming=true", ODataVersion.V4); mediaTypeWithFormat.Should().BeJsonLight().And.BeStreaming(); TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "metadata").Should().BeTrue(); TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "streaming").Should().BeTrue(); }
public void NonStreamingAcceptShouldResolveToNonStreamingResponse() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=false", ODataVersion.V4); mediaTypeWithFormat.Should().BeJsonLight().And.NotBeStreaming(); TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "odata.metadata").Should().BeTrue(); TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "odata.streaming").Should().BeTrue(); }
public void NonStreamingAcceptShouldResolveToNonStreamingResponse_Without_Prefix() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;metadata=minimal;streaming=false", ODataVersion.V4); mediaTypeWithFormat.BeJsonLight().NotBeStreaming(); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "metadata")); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "streaming")); }
public void ODataParameterShouldBeCaseInsensitive() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MeTaDAtA=MinIMaL", ODataVersion.V4).BeJsonLight().HaveDefaultMetadata(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MeTaDAta=FuLl", ODataVersion.V4).BeJsonLight().HaveFullMetadata(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MetADAtA=nONe", ODataVersion.V4).BeJsonLight().HaveNoMetadata(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;oDaTa.MeTaDaTa=MinIMaL", ODataVersion.V4).BeJsonLight().HaveDefaultMetadata(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ODATA.MeTaDaTa=FuLl", ODataVersion.V4).BeJsonLight().HaveFullMetadata(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;oDaTa.MeTaDaTa=nONe", ODataVersion.V4).BeJsonLight().HaveNoMetadata(); }
public void StreamingAcceptShouldResolveToStreamingResponse() { var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=true", ODataVersion.V4); mediaTypeWithFormat.BeJsonLight().BeStreaming().HaveDefaultMetadata(); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "odata.metadata")); Assert.True(TestMediaTypeWithFormat.MediaTypeContains(mediaTypeWithFormat.MediaType, "odata.streaming")); }
public void NotIeee754CompatibleAcceptShouldResolveToNotCompatible() { string[] args = { "application/json;IEEE754Compatible=false", "application/json" }; foreach (var arg in args) { TestMediaTypeWithFormat.GetResponseTypeFromAccept(arg, ODataVersion.V4).BeJsonLight().NotBeIeee754Compatible(); } }
public void StreamingParameterShouldBeCaseInsensitive() { TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;OdAtA.sTrEaMinG=TrUe", ODataVersion.V4).BeJsonLight().BeStreaming(); TestMediaTypeWithFormat.ParseContentType("APpLiCAtIOn/jSoN;oDaTa.stReAMinG=fAlSe", ODataVersion.V4).BeJsonLight().NotBeStreaming(); TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;sTrEaMinG=TrUe", ODataVersion.V4).BeJsonLight().BeStreaming(); TestMediaTypeWithFormat.ParseContentType("APpLiCAtIOn/jSoN;stReAMinG=fAlSe", ODataVersion.V4).BeJsonLight().NotBeStreaming(); var mediaTypeWithFormat = TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;OdAtA.sTrEaMinG=TrUe", ODataVersion.V4); mediaTypeWithFormat.BeJsonLight().BeStreaming(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("APpLiCAtIOn/jSoN;oDaTa.stReAMinG=fAlSe", ODataVersion.V4).BeJsonLight().NotBeStreaming(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;sTrEaMinG=TrUe", ODataVersion.V4).BeJsonLight().BeStreaming(); TestMediaTypeWithFormat.GetResponseTypeFromAccept("APpLiCAtIOn/jSoN;stReAMinG=fAlSe", ODataVersion.V4).BeJsonLight().NotBeStreaming(); }
public void StreamingShouldBePreferredOverNonStreaming() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=true,application/json;odata.metadata=minimal;odata.streaming=false", ODataVersion.V4).BeJsonLight().BeStreaming(); }
public void Ieee754CompatibleAcceptShouldBeResolved() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;IEEE754Compatible=true", ODataVersion.V4).BeJsonLight().BeIeee754Compatible(); }
public void UnspecifiedAcceptShouldResolveToStreamingResponse_Without_Prefix() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;metadata=minimal", ODataVersion.V4).BeJsonLight().BeStreaming(); }
public void StreamingAcceptShouldResolveToStreamingResponse() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=true", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming(); }
public void QualifiedJsonShouldThrow() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json,application/json;odata.metadata=verbose", ODataVersion.V4).BeJsonLight().HaveDefaultMetadata(); }
public void AllMetadataShouldBePreferedOverNone() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=full,application/json;odata.metadata=none", ODataVersion.V4).BeJsonLight().HaveFullMetadata(); }
public void DefaultMetadataShouldBePreferedOverAll() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal,application/json;odata.metadata=full", ODataVersion.V4).BeJsonLight().HaveDefaultMetadata(); }
public void DefaultMetadataAcceptShouldSucceed() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal", ODataVersion.V4).BeJsonLight().HaveDefaultMetadata(); }
public void MetadataNoneAcceptShouldSucceed() { TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=none", ODataVersion.V4).BeJsonLight().HaveNoMetadata(); }