Exemplo n.º 1
0
        public async Task SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks(bool produceTerseOutput)
        {
            // Arrange
            var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
            var writer             = new OpenApiJsonWriter(outputStringWriter, new OpenApiJsonWriterSettings {
                Terse = produceTerseOutput
            });

            // Act
            ReferencedCallback.SerializeAsV3WithoutReference(writer);
            writer.Flush();
            var actual = outputStringWriter.GetStringBuilder().ToString();

            // Assert
            await Verifier.Verify(actual).UseParameters(produceTerseOutput);
        }
Exemplo n.º 2
0
        public void SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks()
        {
            // Arrange
            var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
            var writer             = new OpenApiJsonWriter(outputStringWriter);
            var expected           =
                @"{
  ""$request.body#/url"": {
    ""post"": {
      ""requestBody"": {
        ""content"": {
          ""application/json"": {
            ""schema"": {
              ""type"": ""object""
            }
          }
        }
      },
      ""responses"": {
        ""200"": {
          ""description"": ""Success""
        }
      }
    }
  }
}";

            // Act
            ReferencedCallback.SerializeAsV3WithoutReference(writer);
            writer.Flush();
            var actual = outputStringWriter.GetStringBuilder().ToString();

            // Assert
            actual   = actual.MakeLineBreaksEnvironmentNeutral();
            expected = expected.MakeLineBreaksEnvironmentNeutral();
            actual.Should().Be(expected);
        }