コード例 #1
0
        public void ParsingPlainTextContent()
        {
            string plainText = "test";
            Dictionary <string, OpenApiMediaType> content = new Dictionary <string, OpenApiMediaType>
            {
                { "text/plain", new OpenApiMediaType {
                      Example = new OpenApiString(plainText)
                  } }
            };

            string example = ExamplesParser.ParseExample(content);

            Assert.AreEqual(plainText, example);
        }
コード例 #2
0
        public void ParsingJsonContent()
        {
            string jsonTemplate = "{\n  \"testKey1\": \"testValue\",\n  \"testKey2\": \"testValue\"\n}";
            Dictionary <string, OpenApiMediaType> content = new Dictionary <string, OpenApiMediaType>
            {
                {
                    "application/json", new OpenApiMediaType
                    {
                        Example = new OpenApiObject
                        {
                            { "testKey1", new OpenApiString("testValue") },
                            { "testKey2", new OpenApiString("testValue") }
                        }
                    }
                }
            };

            string example = ExamplesParser.ParseExample(content);

            Assert.AreEqual(jsonTemplate, example);
        }
コード例 #3
0
 public void ParsingNotSupportedContentTypeShouldReturnNull(string contentType)
 {
     Assert.IsNull(ExamplesParser.ParseExample(new Dictionary <string, OpenApiMediaType> {
         { contentType, null }
     }));
 }