public void SerializeAdvancedTagAsV2JsonWithoutReferenceWorks() { // Arrange var outputStringWriter = new StringWriter(); var writer = new OpenApiJsonWriter(outputStringWriter); var expected = @"{ ""name"": ""pet"", ""description"": ""Pets operations"", ""externalDocs"": { ""description"": ""Find more info here"", ""url"": ""https://example.com"" }, ""x-tag-extension"": null }"; // Act AdvancedTag.SerializeAsV2WithoutReference(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); actual.Should().Be(expected); }
public async Task SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var writer = new OpenApiJsonWriter(outputStringWriter, new OpenApiJsonWriterSettings { Terse = produceTerseOutput }); // Act BasicTag.SerializeAsV2WithoutReference(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert await Verifier.Verify(actual).UseParameters(produceTerseOutput); }
public void SerializeBasicTagAsV2JsonWithoutReferenceWorks() { // Arrange var outputStringWriter = new StringWriter(); var writer = new OpenApiJsonWriter(outputStringWriter); var expected = "{ }"; // Act BasicTag.SerializeAsV2WithoutReference(writer); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); actual.Should().Be(expected); }