private async Task <IEnumerable <string> > LoadScriptsAsync( SourceFileParametrization fileParametrization, CancellationToken ct) { if (fileParametrization.FilePath != null) { var script = await _fileGateway.GetFileContentAsync( fileParametrization.FilePath, ct); return(new[] { script }); } else if (fileParametrization.FolderPath != null) { var scripts = _fileGateway .ChangeFolder(fileParametrization.FolderPath) .GetFolderContentsAsync(fileParametrization.Extensions, ct); var contents = (await scripts.ToEnumerableAsync()) .Select(t => t.content); return(contents); } else { throw new InvalidOperationException("We should never get here"); } }