@@ -175,6 +175,48 @@ End Sub
175
175
Assert . AreEqual ( expected , project . Object . VBComponents . Item ( "Comp2" ) . CodeModule . Lines ( ) ) ;
176
176
}
177
177
178
+ [ TestMethod ]
179
+ public void IndentModule_CanExecute_NullActiveCodePane ( )
180
+ {
181
+ var builder = new MockVbeBuilder ( ) ;
182
+ VBComponent component ;
183
+ var vbe = builder . BuildFromSingleStandardModule ( "" , out component ) ;
184
+ vbe . Setup ( v => v . ActiveCodePane ) . Returns ( ( CodePane ) null ) ;
185
+
186
+ var mockHost = new Mock < IHostApplication > ( ) ;
187
+ mockHost . SetupAllProperties ( ) ;
188
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( new Mock < ISinks > ( ) . Object ) ) ;
189
+
190
+ parser . Parse ( new CancellationTokenSource ( ) ) ;
191
+ if ( parser . State . Status >= ParserState . Error )
192
+ {
193
+ Assert . Inconclusive ( "Parser Error" ) ;
194
+ }
195
+
196
+ var indentCommand = new IndentCurrentModuleCommand ( vbe . Object , CreateIndenter ( vbe . Object ) ) ;
197
+ Assert . IsFalse ( indentCommand . CanExecute ( null ) ) ;
198
+ }
199
+
200
+ [ TestMethod ]
201
+ public void IndentModule_CanExecute ( )
202
+ {
203
+ var builder = new MockVbeBuilder ( ) ;
204
+ VBComponent component ;
205
+ var vbe = builder . BuildFromSingleStandardModule ( "" , out component ) ;
206
+ var mockHost = new Mock < IHostApplication > ( ) ;
207
+ mockHost . SetupAllProperties ( ) ;
208
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( new Mock < ISinks > ( ) . Object ) ) ;
209
+
210
+ parser . Parse ( new CancellationTokenSource ( ) ) ;
211
+ if ( parser . State . Status >= ParserState . Error )
212
+ {
213
+ Assert . Inconclusive ( "Parser Error" ) ;
214
+ }
215
+
216
+ var indentCommand = new IndentCurrentModuleCommand ( vbe . Object , CreateIndenter ( vbe . Object ) ) ;
217
+ Assert . IsTrue ( indentCommand . CanExecute ( null ) ) ;
218
+ }
219
+
178
220
private static IIndenter CreateIndenter ( VBE vbe )
179
221
{
180
222
var settings = new Mock < IndenterSettings > ( ) ;
0 commit comments