private void CheckElementIsPublicAndCreateWarningIfNot(IAccessRightsOwnerDeclaration declaration, IEnumerable <IAttribute> testingAttributes)
        {
            AccessRights accessRights = declaration.GetAccessRights();

            if (accessRights == AccessRights.PUBLIC)
            {
                return;
            }

            foreach (var attribute in testingAttributes)
            {
                IHighlighting highlighting;

                if (declaration.DeclaredElement.IsClass())
                {
                    highlighting = new ClassShouldBePublicWarning(attribute.Name.QualifiedName, declaration);
                }
                else
                {
                    highlighting = new MethodShouldBePublicWarning(attribute.Name.QualifiedName, declaration);
                }

                AddHighlighting(declaration.GetNameDocumentRange(), highlighting);
                return;
            }
        }
 public TestFileNameSpaceWarning(IProjectItem offendingProjectItem, IAccessRightsOwnerDeclaration declaration
                                 , string expectedNameSpace
                                 , IProject targetProject, VirtualFileSystemPath targetFolder)
 {
     _offendingProjectItem = offendingProjectItem;
     _declaration          = declaration;
     _expectedNameSpace    = expectedNameSpace;
     _targetProject        = targetProject;
     _targetFolder         = targetFolder;
 }
Ejemplo n.º 3
0
 public TestClassNameSuffixWarning(string expectedSuffix, IAccessRightsOwnerDeclaration declaration)
     : base(string.Format("Test class names should end with '{0}'.", expectedSuffix), declaration)
 {
 }
 public TestFileNameWarning(string toolTip, IAccessRightsOwnerDeclaration declaration)
 {
     _tooltipString = toolTip;
     _declaration   = declaration;
 }
Ejemplo n.º 5
0
 public TestClassNameDoesNotMatchFileNameWarning(string declaredClassName, string testClassNameFromFileName, IAccessRightsOwnerDeclaration declaration)
     : base(string.Format("Test classname and filename are not in sync {0}<>{1}.", declaredClassName, testClassNameFromFileName), declaration)
 {
 }
 public MethodShouldBePublicWarning(string attributeName, IAccessRightsOwnerDeclaration declaration)
     : base(SeverityId, string.Format("Methods with [{0}] must be public.", attributeName), declaration)
 {
 }
 protected AbstractShouldBePublicWarning(string severityId, string toolTip, IAccessRightsOwnerDeclaration declaration)
 {
     _severityId    = severityId;
     _tooltipString = toolTip;
     _declaration   = declaration;
 }
 protected AbstractTestClassNameWarning(string toolTip, IAccessRightsOwnerDeclaration declaration)
 {
     _tooltipString = toolTip;
     _declaration   = declaration;
 }