public void SerializeAdvancedLinkAsV3JsonWorks() { // Arrange var outputStringWriter = new StringWriter(); var writer = new OpenApiJsonWriter(outputStringWriter); var expected = @"{ ""operationId"": ""operationId1"", ""parameters"": { ""parameter1"": ""$request.path.id"" }, ""requestBody"": { ""property1"": true }, ""description"": ""description1"", ""server"": { ""description"": ""serverDescription1"" } }"; // Act AdvancedLink.SerializeAsV3(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); actual.Should().Be(expected); }
public async Task SerializeAdvancedLinkAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var writer = new OpenApiJsonWriter(outputStringWriter, new OpenApiJsonWriterSettings { Terse = produceTerseOutput }); // Act AdvancedLink.SerializeAsV3(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert await Verifier.Verify(actual).UseParameters(produceTerseOutput); }
public void SerializeReferencedLinkAsV3JsonWorks() { // Arrange var outputStringWriter = new StringWriter(); var writer = new OpenApiJsonWriter(outputStringWriter); var expected = @"{ ""$ref"": ""#/components/links/example1"" }"; // Act ReferencedLink.SerializeAsV3(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); actual.Should().Be(expected); }