public void ParseScalarIntegerAsAnyShouldSucceed() { var input = @" 10 "; var yamlStream = new YamlStream(); yamlStream.Load(new StringReader(input)); var yamlNode = yamlStream.Documents.First().RootNode; var context = new ParsingContext(); var diagnostic = new OpenApiDiagnostic(); var node = new ValueNode(context, diagnostic, (YamlScalarNode)yamlNode); var any = node.CreateAny(); diagnostic.Errors.Should().BeEmpty(); any.ShouldBeEquivalentTo( new OpenApiInteger(10) ); }
public void ParseScalarDateTimeAsAnyShouldSucceed() { var input = @" 2012-07-23T12:33:00 "; var yamlStream = new YamlStream(); yamlStream.Load(new StringReader(input)); var yamlNode = yamlStream.Documents.First().RootNode; var context = new ParsingContext(); var diagnostic = new OpenApiDiagnostic(); var node = new ValueNode(context, diagnostic, (YamlScalarNode)yamlNode); var any = node.CreateAny(); diagnostic.Errors.Should().BeEmpty(); any.ShouldBeEquivalentTo( new OpenApiDateTime(DateTimeOffset.Parse("2012-07-23T12:33:00")) ); }