예제 #1
0
        public IEnumerable <NPath> AllSourceFiles()
        {
            _rootDirectory.DirectoryMustExist();

            foreach (var file in _rootDirectory.Files("*.cs"))
            {
                yield return(file);
            }

            foreach (var subDir in _rootDirectory.Directories())
            {
                if (subDir.FileName == "bin" || subDir.FileName == "obj" || subDir.FileName == "Properties")
                {
                    continue;
                }

                foreach (var file in subDir.Files("*.cs", true))
                {
                    // Magic : Anything in a directory named Dependnecies is assumed to be a dependency to a test case
                    // and never a test itself
                    // This makes life a little easier when writing these supporting files as it removes some contraints you would previously have
                    // had to follow such as ensuring a class exists that matches the file name and putting [NotATestCase] on that class
                    if (file.Parent.FileName == "Dependencies")
                    {
                        continue;
                    }

                    yield return(file);
                }
            }
        }
    static IEnumerable <NPath> CSFilesForDirectory(NPath directory)
    {
        var files             = directory.Files(recurse: true);
        var beeDirs           = directory.Directories(true).Where(d => d.FileName == "bee~").ToList();
        var ignoreDirectories = files.Where(f => f.HasExtension("asmdef") && f.Parent != directory).Select(asmdef => asmdef.Parent).Concat(beeDirs).ToList();

        return(files.Where(f => f.HasExtension("cs") && !ignoreDirectories.Any(i => f.IsChildOf(i))));
    }
예제 #3
0
        public IEnumerable <NPath> AllSourceFiles()
        {
            _rootDirectory.DirectoryMustExist();

            foreach (var file in _rootDirectory.Files("*.cs"))
            {
                yield return(file);
            }

            foreach (var subDir in _rootDirectory.Directories())
            {
                if (subDir.FileName == "bin" || subDir.FileName == "obj" || subDir.FileName == "Properties")
                {
                    continue;
                }

                foreach (var file in subDir.Files("*.cs", true))
                {
                    yield return(file);
                }
            }
        }
예제 #4
0
        public IEnumerable <NPath> AllSourceFiles()
        {
            _rootDirectory.DirectoryMustExist();

            foreach (var file in _rootDirectory.Files("*.cs"))
            {
                yield return(file);
            }

            foreach (var subDir in _rootDirectory.Directories())
            {
                if (subDir.FileName == "bin" || subDir.FileName == "obj" || subDir.FileName == "Properties")
                {
                    continue;
                }

                foreach (var file in subDir.Files("*.cs", true))
                {
                    var relativeParents = file.RelativeTo(_rootDirectory);
                    // Magic : Anything in a directory named Dependencies is assumed to be a dependency to a test case
                    // and never a test itself
                    // This makes life a little easier when writing these supporting files as it removes some constraints you would previously have
                    // had to follow such as ensuring a class exists that matches the file name and putting [NotATestCase] on that class
                    if (relativeParents.RecursiveParents.Any(p => p.Elements.Any() && p.FileName == "Dependencies"))
                    {
                        continue;
                    }

                    // Magic: Anything in a directory named Individual is expected to be ran by it's own [Test] rather than as part of [TestCaseSource]
                    if (relativeParents.RecursiveParents.Any(p => p.Elements.Any() && p.FileName == "Individual"))
                    {
                        continue;
                    }

                    yield return(file);
                }
            }
        }
예제 #5
0
 private static bool IsGitFolder(NPath path)
 {
     return(path.Directories(".git").Any());
 }