Bari.Core.Test.Loader.YamlParserTest.Load C# (CSharp) Method

Load() private method

private Load ( string source ) : YamlDocument
source string
return YamlDotNet.RepresentationModel.YamlDocument
        private YamlDocument Load(string source)
        {
            using (var reader = new StringReader(source))
            {
                var yaml = new YamlStream();
                yaml.Load(reader);

                if (yaml.Documents.Count == 1 &&
                    yaml.Documents[0] != null &&
                    yaml.Documents[0].RootNode != null)
                    return yaml.Documents[0];
                else
                    throw new InvalidSpecificationException(
                        string.Format("The yaml source contains multiple yaml documents!"));
            }
        }