예제 #1
0
        public void CanHandle_WithNoOpenApiKeyInDocument_ReturnsFalse()
        {
            string  json    = @"{
  ""info"": {
    ""version"": ""v1""
  },
   ""paths"": {
  }
}";
            JObject jobject = JObject.Parse(json);
            OpenApiV3EndpointMetadataReader openApiV3EndpointMetadataReader = new OpenApiV3EndpointMetadataReader();

            bool?result = openApiV3EndpointMetadataReader.CanHandle(jobject);

            Assert.False(result);
        }
예제 #2
0
        public void CanHandle_WithOpenApiVersionGreaterThanThree_ReturnsFalse()
        {
            string  json    = @"{
  ""openapi"": ""4.0.0"",
  ""info"": {
    ""version"": ""v1""
  },
   ""paths"": {
  }
}";
            JObject jobject = JObject.Parse(json);
            OpenApiV3EndpointMetadataReader openApiV3EndpointMetadataReader = new OpenApiV3EndpointMetadataReader();

            bool?result = openApiV3EndpointMetadataReader.CanHandle(jobject);

            Assert.False(result);
        }
예제 #3
0
        public void CanHandle_WithValidOpenApiVersionInDocument_ReturnsTrue()
        {
            string  json    = @"{
  ""openapi"": ""3.0.0"",
  ""info"": {
    ""version"": ""v1""
  },
   ""paths"": {
  }
}";
            JObject jobject = JObject.Parse(json);
            OpenApiV3EndpointMetadataReader openApiV3EndpointMetadataReader = new OpenApiV3EndpointMetadataReader();

            bool?result = openApiV3EndpointMetadataReader.CanHandle(jobject);

            Assert.True(result);
        }