Beispiel #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));
        }
Beispiel #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));
        }