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