public void Read_WithJObjectFormatNotSupportedByAnyExistingReader_ReturnsNull()
        {
            string  json    = @"{
  ""info"": {
    ""version"": ""v1"",
    ""title"": ""My API""
  }
}";
            JObject jobject = JObject.Parse(json);
            EndpointMetadataReader endpointMetadataReader = new EndpointMetadataReader();

            Assert.Null(endpointMetadataReader.Read(jobject));
        }
        private static async Task <IEnumerable <EndpointMetadata> > GetSwaggerDocAsync(HttpClient client, Uri uri)
        {
            var resp = await client.GetAsync(uri).ConfigureAwait(false);

            resp.EnsureSuccessStatusCode();
            string responseString = await resp.Content.ReadAsStringAsync().ConfigureAwait(false);

            JsonSerializer serializer = new JsonSerializer {
                PreserveReferencesHandling = PreserveReferencesHandling.All
            };
            JObject responseObject        = (JObject)serializer.Deserialize(new StringReader(responseString), typeof(JObject));
            EndpointMetadataReader reader = new EndpointMetadataReader();

            responseObject = await PointerUtil.ResolvePointersAsync(uri, responseObject, client).ConfigureAwait(false) as JObject;

            if (responseObject is null)
            {
                return(new EndpointMetadata[0]);
            }

            return(reader.Read(responseObject));
        }
        public void RegisterReader_AddNewReader_VerifyReadReturnsEndpointMetadataCollection()
        {
            string           json             = @"{
  ""fakeApi"": ""1.0.0"",
  ""info"": {
    ""version"": ""v1""
  }
}";
            JObject          jobject          = JObject.Parse(json);
            EndpointMetadata endpointMetadata = new EndpointMetadata(path: "/api/Employees",
                                                                     requestsByMethodAndContentType: new Dictionary <string, IReadOnlyDictionary <string, IReadOnlyList <Parameter> > >());
            EndPointMetaDataReaderStub endPointMetaDataReaderStub = new EndPointMetaDataReaderStub(endpointMetadata);

            EndpointMetadataReader endpointMetadataReader = new EndpointMetadataReader();

            endpointMetadataReader.RegisterReader(endPointMetaDataReaderStub);

            IEnumerable <EndpointMetadata> result = endpointMetadataReader.Read(jobject);

            Assert.Single(result);
            Assert.Equal(endpointMetadata, result.First());
        }