Exemplo n.º 1
0
        public ITestFile GetTestFile(ICSharpFile csharpFile)
        {
            var assemblyIdentity = new Identity(_project.GetOutputFilePath().FullPath);
            var classTests       = TreeNodeEnumerable.Create(
                () =>
            {
                csharpFile.AssertIsValid();
                return(GetClassDeclarations(csharpFile)
                       .TakeWhile(_notInterrupted)
                       .Select(x => GetClassTest(x, assemblyIdentity))
                       .WhereNotNull());
            });

            return(new TestFile(classTests, csharpFile));
        }
        private static ICSharpFile GetCodeFile(IProject project, string fileName)
        {
            IProjectFile projectFile = project.GetAllProjectFiles(file => file.Name.Equals(fileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            if (projectFile == null)
            {
                return(null);
            }

            IPsiSourceFile psiSourceFile = projectFile.ToSourceFile();

            if (psiSourceFile == null)
            {
                return(null);
            }

            ICSharpFile cSharpFile = psiSourceFile.GetCSharpFile();

            cSharpFile.AssertIsValid();

            return(cSharpFile);
        }