@@ -54,6 +54,32 @@ Public Sub Foo()
54
54
Assert . AreEqual ( expectedCode , actualCode ) ;
55
55
}
56
56
57
+ [ Test ]
58
+ [ Category ( "QuickFixes" ) ]
59
+ public void KnownModuleAttributeWithoutAnnotationWhileOtherAttributeWithAnnotationPresent_QuickFixWorks ( )
60
+ {
61
+ const string inputCode =
62
+ @"Attribute VB_PredeclaredID = True
63
+ Attribute VB_Exposed = True
64
+ '@Exposed
65
+ Public Sub Foo()
66
+ Const const1 As Integer = 9
67
+ End Sub" ;
68
+ //The attribute not present in the code pane code in the VBE.
69
+ //So adding on top is OK.
70
+ const string expectedCode =
71
+ @"'@PredeclaredId
72
+ Attribute VB_PredeclaredID = True
73
+ Attribute VB_Exposed = True
74
+ '@Exposed
75
+ Public Sub Foo()
76
+ Const const1 As Integer = 9
77
+ End Sub" ;
78
+
79
+ var actualCode = ApplyQuickFixToFirstInspectionResult ( inputCode , state => new MissingModuleAnnotationInspection ( state ) ) ;
80
+ Assert . AreEqual ( expectedCode , actualCode ) ;
81
+ }
82
+
57
83
[ Test ]
58
84
[ Category ( "QuickFixes" ) ]
59
85
public void KnownMemberAttributeWithoutAnnotation_QuickFixWorks ( )
@@ -100,6 +126,31 @@ Public Sub Foo()
100
126
Assert . AreEqual ( expectedCode , actualCode ) ;
101
127
}
102
128
129
+ [ Test ]
130
+ [ Category ( "QuickFixes" ) ]
131
+ public void KnownMemberAttributeWithoutAnnotationWhileOtherAttributeWithAnnotationPresent_QuickFixWorks ( )
132
+ {
133
+ const string inputCode =
134
+ @"'@DefaultMember
135
+ Public Sub Foo()
136
+ Attribute Foo.VB_Description = ""Desc""
137
+ Attribute Foo.VB_UserMemId = 0
138
+ Const const1 As Integer = 9
139
+ End Sub" ;
140
+
141
+ const string expectedCode =
142
+ @"'@DefaultMember
143
+ '@Description ""Desc""
144
+ Public Sub Foo()
145
+ Attribute Foo.VB_Description = ""Desc""
146
+ Attribute Foo.VB_UserMemId = 0
147
+ Const const1 As Integer = 9
148
+ End Sub" ;
149
+
150
+ var actualCode = ApplyQuickFixToFirstInspectionResult ( inputCode , state => new MissingMemberAnnotationInspection ( state ) ) ;
151
+ Assert . AreEqual ( expectedCode , actualCode ) ;
152
+ }
153
+
103
154
protected override IQuickFix QuickFix ( RubberduckParserState state )
104
155
{
105
156
return new AddAttributeAnnotationQuickFix ( new AnnotationUpdater ( ) , new AttributeAnnotationProvider ( ) ) ;
0 commit comments