@@ -269,6 +269,28 @@ public void RemoveArgument_LastArgumentRemoved()
269
269
}
270
270
}
271
271
272
+ [ Test ]
273
+ [ Category ( "Refactorings" ) ]
274
+ public void ShowAdjustAttributeOption_AttributeAnnotation_True ( )
275
+ {
276
+ var viewModel = TestViewModel ( DeclarationType . Procedure ) ;
277
+ var annotation = new DescriptionAnnotation ( ) ;
278
+ viewModel . Annotation = annotation ;
279
+
280
+ Assert . IsTrue ( viewModel . ShowAdjustAttributeOption ) ;
281
+ }
282
+
283
+ [ Test ]
284
+ [ Category ( "Refactorings" ) ]
285
+ public void ShowAdjustAttributeOption_NotAnAttributeAnnotation_False ( )
286
+ {
287
+ var viewModel = TestViewModel ( DeclarationType . Procedure ) ;
288
+ var annotation = new IgnoreAnnotation ( ) ;
289
+ viewModel . Annotation = annotation ;
290
+
291
+ Assert . IsFalse ( viewModel . ShowAdjustAttributeOption ) ;
292
+ }
293
+
272
294
[ Test ]
273
295
[ Category ( "Refactorings" ) ]
274
296
public void SetAnnotation_ResetsArguments ( )
@@ -291,6 +313,20 @@ public void SetAnnotation_SetsAnnotationOnModel()
291
313
Assert . AreSame ( viewModel . Model . Annotation , annotation ) ;
292
314
}
293
315
316
+ [ Test ]
317
+ [ Category ( "Refactorings" ) ]
318
+ [ TestCase ( true , true ) ]
319
+ [ TestCase ( false , true ) ]
320
+ [ TestCase ( true , false ) ]
321
+ [ TestCase ( false , false ) ]
322
+ public void SetAdjustAttribute_SetsAdjustAttributeOnModel ( bool initialValue , bool valueToSet )
323
+ {
324
+ var viewModel = TestViewModel ( DeclarationType . Procedure , initialAdjustAttribute : initialValue ) ;
325
+ viewModel . AdjustAttribute = valueToSet ;
326
+
327
+ Assert . AreEqual ( viewModel . Model . AdjustAttribute , valueToSet ) ;
328
+ }
329
+
294
330
[ Test ]
295
331
[ Category ( "Refactorings" ) ]
296
332
public void ModelIsInputModelFromCreation ( )
@@ -321,10 +357,10 @@ public void DialogOK_SetsArguments()
321
357
}
322
358
323
359
324
- private AnnotateDeclarationViewModel TestViewModel ( DeclarationType targetDeclarationType , IAnnotation initialAnnotation = null , bool localScope = false )
360
+ private AnnotateDeclarationViewModel TestViewModel ( DeclarationType targetDeclarationType , IAnnotation initialAnnotation = null , bool localScope = false , bool initialAdjustAttribute = false )
325
361
{
326
362
var argumentFactory = MockArgumentFactory ( ) . Object ;
327
- return TestViewModel ( targetDeclarationType , argumentFactory , initialAnnotation , localScope ) ;
363
+ return TestViewModel ( targetDeclarationType , argumentFactory , initialAnnotation , localScope , initialAdjustAttribute ) ;
328
364
}
329
365
330
366
private Mock < IAnnotationArgumentViewModelFactory > MockArgumentFactory ( IReadOnlyList < bool > hasErrorSpecifications = null )
@@ -353,7 +389,7 @@ private Mock<IAnnotationArgumentViewModel> MockArgument(AnnotationArgumentType a
353
389
return mockArgument ;
354
390
}
355
391
356
- private AnnotateDeclarationViewModel TestViewModel ( DeclarationType targetDeclarationType , IAnnotationArgumentViewModelFactory argumentFactory , IAnnotation initialAnnotation = null , bool localScope = false )
392
+ private AnnotateDeclarationViewModel TestViewModel ( DeclarationType targetDeclarationType , IAnnotationArgumentViewModelFactory argumentFactory , IAnnotation initialAnnotation = null , bool localScope = false , bool initialAdjustAttribute = false )
357
393
{
358
394
var targetDeclaration = TestDeclaration ( targetDeclarationType , localScope ) ;
359
395
var model = new AnnotateDeclarationModel ( targetDeclaration , initialAnnotation ) ;
0 commit comments