示例#1
0
        public static ISessionDescriptor CreateFromYamlFile(this ISessionDescriptorProvider provider, IParser parser)
        {
            if (!(provider is YamlSessionDescriptorProvider yamlFactory))
            {
                throw new InvalidOperationException(
                          $"Provider must be of type '{nameof(YamlSessionDescriptorProvider)}'.");
            }

            return(yamlFactory.Create(parser));
        }
示例#2
0
        public static ISessionDescriptor CreateFromYamlFile(this ISessionDescriptorProvider provider, string path)
        {
            if (!(provider is YamlSessionDescriptorProvider yamlFactory))
            {
                throw new InvalidOperationException(
                          $"Provider must be of type '{nameof(YamlSessionDescriptorProvider)}'.");
            }

            var input = File.ReadAllText(path);

            return(yamlFactory.Create(input));
        }