public void Ieee754CompatibleShouldBeCaseInsensitive()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;ieee754Compatible=TRUE", ODataVersion.V4).Should().BeJsonLight().And.BeIeee754Compatible();
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;ieee754Compatible=False", ODataVersion.V4).Should().BeJsonLight().And.NotBeIeee754Compatible();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ieee754Compatible=TRUE", ODataVersion.V4).Should().BeJsonLight().And.BeIeee754Compatible();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ieee754Compatible=False", ODataVersion.V4).Should().BeJsonLight().And.NotBeIeee754Compatible();
 }
 public void StreamingParameterShouldBeCaseInsensitive()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;OdAtA.sTrEaMinG=TrUe", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming();
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("APpLiCAtIOn/jSoN;oDaTa.stReAMinG=fAlSe", ODataVersion.V4).Should().BeJsonLight().And.NotBeStreaming();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;OdAtA.sTrEaMinG=TrUe", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming();
     TestMediaTypeWithFormat.ParseContentType("APpLiCAtIOn/jSoN;oDaTa.stReAMinG=fAlSe", ODataVersion.V4).Should().BeJsonLight().And.NotBeStreaming();
 }
        public void UnrecognizedParameterForAcceptShouldFail()
        {
            Action acceptUnrecognizedParameter = () => TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;foo=bar", ODataVersion.V4);

            acceptUnrecognizedParameter
            .ShouldThrow <ODataException>()
            .WithMessage(ErrorStrings.MediaTypeUtils_DidNotFindMatchingMediaType("*", "application/json;odata.metadata=minimal;foo=bar"), ComparisonMode.Wildcard);
        }
 public void ODataParameterShouldBeCaseInsensitive()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MeTaDAtA=MinIMaL", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MeTaDAta=FuLl", ODataVersion.V4).Should().BeJsonLight().And.SpecifyAllMetadata();
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("appLICatIOn/jSOn;oDaTa.MetADAtA=nONe", ODataVersion.V4).Should().BeJsonLight().And.SpecifyNoMetadata();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;oDaTa.MeTaDaTa=MinIMaL", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;ODATA.MeTaDaTa=FuLl", ODataVersion.V4).Should().BeJsonLight().And.SpecifyAllMetadata();
     TestMediaTypeWithFormat.ParseContentType("appLICatIOn/jSOn;oDaTa.MeTaDaTa=nONe", ODataVersion.V4).Should().BeJsonLight().And.SpecifyNoMetadata();
 }
 public void NotIeee754CompatibleAcceptShouldResolveToNotCompatible()
 {
     string[] args =
     {
         "application/json;IEEE754Compatible=false",
         "application/json"
     };
     foreach (var arg in args)
     {
         TestMediaTypeWithFormat.GetResponseTypeFromAccept(arg, ODataVersion.V4).Should().BeJsonLight().And.NotBeIeee754Compatible();
     }
 }
        public void MatchInfoCacheShouldWork()
        {
            var result1 = TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal", ODataVersion.V4);
            var result2 = TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal", ODataVersion.V4);
            var result3 = TestMediaTypeWithFormat.ParseContentType("application/json", ODataVersion.V4);
            var result4 = TestMediaTypeWithFormat.ParseContentType("application/json", ODataVersion.V4, ODataMediaTypeResolver.GetMediaTypeResolver(true));
            var result5 = TestMediaTypeWithFormat.ParseContentType("application/json", ODataVersion.V4, ODataMediaTypeResolver.GetMediaTypeResolver(true));

            result1.Should().BeJsonLight().And.SpecifyDefaultMetadata();
            result2.Should().BeJsonLight().And.SpecifyDefaultMetadata();
            result3.Should().BeUnspecifiedJson();
            result4.Should().BeUnspecifiedJson();
            result5.Should().BeUnspecifiedJson();
        }
 public void Ieee754CompatibleShouldParseCorrectly()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal;IEEE754Compatible=true", ODataVersion.V4).Should().BeJsonLight().And.BeIeee754Compatible();
 }
 public void UnspecifiedIeee754CompatibleInContentTypeShouldMeanNegative()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal", ODataVersion.V4).Should().BeJsonLight().And.NotBeIeee754Compatible();
 }
 public static MediaTypeAssertions Should(this TestMediaTypeWithFormat mediaType)
 {
     return(new MediaTypeAssertions(mediaType));
 }
 public void UnspecifiedAcceptShouldResolveToStreamingResponse()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming();
 }
 public void NonStreamingAcceptShouldResolveToNonStreamingResponse()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=false", ODataVersion.V4).Should().BeJsonLight().And.NotBeStreaming();
 }
 public void StreamingShouldBePreferredOverNonStreaming()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;odata.streaming=true,application/json;odata.metadata=minimal;odata.streaming=false", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming();
 }
 public void DefaultMetadataAcceptShouldSucceed()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
 }
 public void MetadataNoneAcceptShouldSucceed()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=none", ODataVersion.V4).Should().BeJsonLight().And.SpecifyNoMetadata();
 }
 public void UnspecifiedAcceptShouldResolveToDefault()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
 }
 public void DefaultMetadataContentTypeShouldSucceed()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
 }
 public void MetadataNoneContentTypeShouldSucceed()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=none", ODataVersion.V4).Should().BeJsonLight().And.SpecifyNoMetadata();
 }
 public void JsonFormatShouldBeJsonLightInV3()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromFormat(ODataFormat.Json, ODataVersion.V4).Should().BeJsonLight();
 }
 public void JsonLightFormatShouldResolveToMinimalMetadataAndStreaming()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromFormat(ODataFormat.Json, ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata().And.BeStreaming();
 }
 public void DefaultMetadataShouldBePreferedOverAll()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal,application/json;odata.metadata=full", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
 }
 public void AllMetadataShouldBePreferedOverNone()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=full,application/json;odata.metadata=none", ODataVersion.V4).Should().BeJsonLight().And.SpecifyAllMetadata();
 }
 public void UnqualifiedContentTypeInV3ShouldBeJsonLightButUnspecified()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json", ODataVersion.V4).Should().BeUnspecifiedJson().And.HaveExactFormat(ODataFormat.Json);
 }
 public MediaTypeAssertions(TestMediaTypeWithFormat mediaType)
     : base(mediaType)
 {
 }
 public void StreamingContentTypeShouldParseCorrectly()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal;odata.streaming=true", ODataVersion.V4).Should().BeJsonLight().And.BeStreaming();
 }
 public void Ieee754CompatibleAcceptShouldBeResolved()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json;odata.metadata=minimal;IEEE754Compatible=true", ODataVersion.V4).Should().BeJsonLight().And.BeIeee754Compatible();
 }
 public void UnrecognizedContentTypeParameterShouldMeanNoStreaming()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal;foo=bar", ODataVersion.V4).Should().BeJsonLight().And.NotBeStreaming();
 }
 public void QualifiedJsonShouldThrow()
 {
     TestMediaTypeWithFormat.GetResponseTypeFromAccept("application/json,application/json;odata.metadata=verbose", ODataVersion.V4).Should().BeJsonLight().And.SpecifyDefaultMetadata();
 }
 public void UnrecognizedContentTypeIeee754CompatibleValueShouldMeanNegative()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal;IEEE754Compatible=none", ODataVersion.V4).Should().BeJsonLight().And.NotBeIeee754Compatible();
 }
 public MediaTypeAssertions(TestMediaTypeWithFormat mediaType)
     : base(mediaType)
 {
 }
 public void UnspecifiedStreamingInContentTypeShouldMeanNoStreaming()
 {
     TestMediaTypeWithFormat.ParseContentType("application/json;odata.metadata=minimal;", ODataVersion.V4).Should().BeJsonLight().And.NotBeStreaming();
 }