private string GetTestFilePath(CurrentClassInfo currentClassInfo)
        {
            var projectDir = GetProjectFolder(currentClassInfo);

            if (string.IsNullOrWhiteSpace(projectDir))
            {
                return(null);
            }

            var projectDirDi = new DirectoryInfo(projectDir);

            if (!projectDirDi.Exists)
            {
                return(null);
            }

            var testProjectName = $"{currentClassInfo.ProjectName}.Tests";
            var testFileNs      = string.Join(Path.DirectorySeparatorChar.ToString(), currentClassInfo.ClassNamespace.Split(new[] { '.' }, StringSplitOptions.None));

            var fnWithoutExt = Path.GetFileNameWithoutExtension(currentClassInfo.SourceFilePath);
            var testFileName = $"{fnWithoutExt}Tests.cs";

            var testFile = Path.Combine(projectDirDi.Parent.FullName, testProjectName, testFileNs, testFileName);

            return(testFile);
        }
        private bool IsTestsFile(IProjectItem projectItem, CurrentClassInfo currentClassInfo)
        {
            var testFile = GetTestFilePath(currentClassInfo);

            if (string.IsNullOrWhiteSpace(testFile))
            {
                return(false);
            }

            return(projectItem.Kind == ProjectItemKind.PHYSICAL_FILE && File.Exists(testFile) && projectItem.Location.FullPath.Equals(testFile, StringComparison.InvariantCultureIgnoreCase));
        }
        private string GetProjectFolder(CurrentClassInfo currentClassInfo)
        {
            var sourceFilePathFi = new FileInfo(currentClassInfo.SourceFilePath);
            var directory        = sourceFilePathFi.Directory;
            var ni = currentClassInfo.ClassNamespace.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Reverse();

            for (var i = 0; i < ni.Count; ++i)
            {
                if (directory.Name.Equals(ni[i], StringComparison.InvariantCultureIgnoreCase))
                {
                    directory = directory.Parent;
                }
                else
                {
                    return(null);
                }
            }

            return(directory.FullName);
        }