Ejemplo n.º 1
0
        public async Task <IList <TestBundle> > LoadTestsAsync(string testDirectoryName)
        {
            _logger.Log(Abstraction.Layer.IO().Meta(new { TestDirectoryName = testDirectoryName }));

            var testFiles =
                _directoryTree
                .Walk(testDirectoryName, PhysicalDirectoryTree.MaxDepth(1), PhysicalDirectoryTree.IgnoreExceptions)
                .WhereFiles(@"\.json$")
                .SelectMany(node => node.FileNames.Select(fileName => Path.Combine(node.DirectoryName, fileName)));

            var testBundles = new List <TestBundle>();

            foreach (var fileName in testFiles) //.Where(fileName => tests is null || tests.Contains(Path.GetFileNameWithoutExtension(fileName), StringComparer.OrdinalIgnoreCase)))
            {
                using (_logger.BeginScope().AttachElapsed())
                {
                    var testBundle = await LoadTestAsync(fileName);

                    if (testBundle is null || !testBundle.Enabled)
                    {
                        continue;
                    }

                    testBundles.Add(testBundle);
                }
            }

            return(testBundles);
        }
Ejemplo n.º 2
0
        public static IEnumerable <IDirectoryTreeNode> WalkSilently([NotNull] this IDirectoryTree directoryTree, [NotNull] string path)
        {
            if (directoryTree == null)
            {
                throw new ArgumentNullException(nameof(directoryTree));
            }
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(directoryTree.Walk(path, _ => { }));
        }
Ejemplo n.º 3
0
 public IEnumerable <IDirectoryTreeNode> Walk(string path, Func <IDirectoryTreeNode, bool> predicate, Action <Exception> onException)
 {
     return(_directoryTree.Walk(Path.Combine(_basePath, path), predicate, onException));
 }