コード例 #1
0
        private static string[] GetTestClassRelativeNamespaceParts([NotNull] ITypeDeclaration classDeclaration, [NotNull] IProject testProject, ReSharperHelperSettings helperSettings)
        {
            var currentProject = classDeclaration.GetProject();

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

            var typeElement = classDeclaration.DeclaredElement;

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

            var relativeSourceNsParts = TrimDefaultProjectNamespace(currentProject, typeElement.GetContainingNamespace().QualifiedName);

            if (!helperSettings.TestsProjectSubNamespace.IsNullOrEmpty())
            {
                string[] subDirParts = StringUtil.FullySplitFQName(helperSettings.TestsProjectSubNamespace);
                relativeSourceNsParts = subDirParts.Concat(relativeSourceNsParts).ToArray();
            }

            return(relativeSourceNsParts);
            //
            //
            // // IEnumerable<string> testProjectDefaultNsParts = StringUtil.FullySplitFQName(testProject.GetDefaultNamespace().NotNull());
            //
            // return testProjectDefaultNsParts.Concat(relativeTypeNamespace).ToArray();
        }