public void SerializeReferencedSecuritySchemeAsV3JsonWorks() { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var writer = new OpenApiJsonWriter(outputStringWriter); var expected = @"{ ""sampleSecurityScheme"": null }"; // Act // Add dummy start object, value, and end object to allow SerializeAsV3 to output security scheme // as property name. writer.WriteStartObject(); ReferencedSecurityScheme.SerializeAsV3(writer); writer.WriteNull(); writer.WriteEndObject(); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert actual = actual.MakeLineBreaksEnvironmentNeutral(); expected = expected.MakeLineBreaksEnvironmentNeutral(); actual.Should().Be(expected); }
public async Task SerializeReferencedSecuritySchemeAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var writer = new OpenApiJsonWriter(outputStringWriter, new OpenApiJsonWriterSettings { Terse = produceTerseOutput }); // Act // Add dummy start object, value, and end object to allow SerializeAsV3 to output security scheme // as property name. writer.WriteStartObject(); ReferencedSecurityScheme.SerializeAsV3(writer); writer.WriteNull(); writer.WriteEndObject(); writer.Flush(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert await Verifier.Verify(actual).UseParameters(produceTerseOutput); }