Example #1
0
        public void EmptyAcceptNoMatch()
        {
            var fixture = new Fixture();

            fixture.Customize(new AutoNSubstituteCustomization());

            var mapping = new ProblemJsonMediaTypeMapping();

            var request = fixture.Create <HttpRequestMessage>();

            var quality = mapping.TryMatchMediaType(request);

            quality.Should().Be(0.0);
        }
Example #2
0
        public void RightAcceptCaseMatch()
        {
            var fixture = new Fixture();

            fixture.Customize(new AutoNSubstituteCustomization());

            var mapping = new ProblemJsonMediaTypeMapping();

            var request = fixture.Create <HttpRequestMessage>();

            request.Headers.Add("accept", new[] { "Application/Problem+JSON", "application/json" });

            var quality = mapping.TryMatchMediaType(request);

            quality.Should().Be(1.0);
        }