コード例 #1
0
        public void ParseBasicXmlShouldSucceed()
        {
            using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "basicXml.yaml")))
            {
                var yamlStream = new YamlStream();
                yamlStream.Load(new StreamReader(stream));
                var yamlNode = yamlStream.Documents.First().RootNode;

                var context    = new ParsingContext();
                var diagnostic = new OpenApiDiagnostic();

                var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode);

                // Act
                var xml = OpenApiV3Deserializer.LoadXml(node);

                // Assert
                xml.ShouldBeEquivalentTo(
                    new OpenApiXml
                {
                    Name      = "name1",
                    Namespace = new Uri("http://example.com/schema/namespaceSample"),
                    Prefix    = "samplePrefix",
                    Wrapped   = true
                });
            }
        }