public void Read_WithSomeMissingValues_Works()
        {
            // Arrange
            var type      = "https://tools.ietf.org/html/rfc7231#section-6.5.4";
            var title     = "Not found";
            var status    = 404;
            var traceId   = "|37dd3dd5-4a9619f953c40a16.";
            var json      = $"{{\"type\":\"{type}\",\"title\":\"{title}\",\"status\":{status},\"traceId\":\"{traceId}\"}}";
            var converter = new ProblemDetailsJsonConverter();
            var reader    = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));

            // Act
            var problemDetails = converter.Read(ref reader, typeof(ProblemDetails), JsonSerializerOptions);

            Assert.Equal(type, problemDetails.Type);
            Assert.Equal(title, problemDetails.Title);
            Assert.Equal(status, problemDetails.Status);
            Assert.Collection(
                problemDetails.Extensions,
                kvp =>
            {
                Assert.Equal("traceId", kvp.Key);
                Assert.Equal(traceId, kvp.Value.ToString());
            });
        }
        public void Read_ThrowsIfJsonIsIncomplete()
        {
            // Arrange
            var json      = "{";
            var converter = new ProblemDetailsJsonConverter();

            // Act & Assert
            var ex = Record.Exception(() =>
            {
                var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
                converter.Read(ref reader, typeof(ProblemDetails), JsonSerializerOptions);
            });

            Assert.IsAssignableFrom <JsonException>(ex);
        }