Bari.Core.Model.Loader.LocalYamlModelLoader.Load C# (CSharp) Method

Load() public method

Loads a suite model from the given source

It is guaranteed that this method will only be called if IModelLoader.Supports return true for the same source.

public Load ( string source ) : Suite
source string Source, can mean anything (file names, urls, markup, etc.)
return Suite
        public Suite Load(string source)
        {
            log.DebugFormat("Loading YAML suite specification from local file {0}...", source);

            using (var reader = File.OpenText(source))
            {
                var yaml = new YamlStream();
                yaml.Load(reader);

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