@@ -59,6 +59,7 @@ End Property
59
59
{
60
60
ImplementLetSetterType = true ,
61
61
ImplementSetSetterType = false ,
62
+ CanImplementLet = true ,
62
63
ParameterName = "value" ,
63
64
PropertyName = "Name"
64
65
} ;
@@ -117,6 +118,7 @@ End Property
117
118
{
118
119
ImplementLetSetterType = true ,
119
120
ImplementSetSetterType = false ,
121
+ CanImplementLet = true ,
120
122
ParameterName = "value" ,
121
123
PropertyName = "Name"
122
124
} ;
@@ -145,11 +147,11 @@ public void EncapsulatePublicField_WithSetter()
145
147
@"Private fizz As Variant
146
148
147
149
Public Property Get Name() As Variant
148
- Name = fizz
150
+ Set Name = fizz
149
151
End Property
150
152
151
153
Public Property Set Name(ByVal value As Variant)
152
- fizz = value
154
+ Set fizz = value
153
155
End Property
154
156
" ;
155
157
@@ -172,6 +174,7 @@ End Property
172
174
{
173
175
ImplementLetSetterType = false ,
174
176
ImplementSetSetterType = true ,
177
+ CanImplementLet = true ,
175
178
ParameterName = "value" ,
176
179
PropertyName = "Name"
177
180
} ;
@@ -223,6 +226,7 @@ End Property
223
226
{
224
227
ImplementLetSetterType = false ,
225
228
ImplementSetSetterType = false ,
229
+ CanImplementLet = true ,
226
230
ParameterName = "value" ,
227
231
PropertyName = "Name"
228
232
} ;
@@ -291,6 +295,7 @@ Function Bar() As Integer
291
295
{
292
296
ImplementLetSetterType = true ,
293
297
ImplementSetSetterType = false ,
298
+ CanImplementLet = true ,
294
299
ParameterName = "value" ,
295
300
PropertyName = "Name"
296
301
} ;
@@ -365,6 +370,7 @@ Property Set Foo(ByVal vall As Variant)
365
370
{
366
371
ImplementLetSetterType = true ,
367
372
ImplementSetSetterType = false ,
373
+ CanImplementLet = true ,
368
374
ParameterName = "value" ,
369
375
PropertyName = "Name"
370
376
} ;
@@ -422,6 +428,7 @@ End Property
422
428
{
423
429
ImplementLetSetterType = true ,
424
430
ImplementSetSetterType = false ,
431
+ CanImplementLet = true ,
425
432
ParameterName = "value" ,
426
433
PropertyName = "Name"
427
434
} ;
@@ -453,15 +460,15 @@ public void EncapsulatePublicField_FieldDeclarationHasMultipleFields_MoveFirst()
453
460
Private fizz As Variant
454
461
455
462
Public Property Get Name() As Variant
456
- Name = fizz
463
+ Set Name = fizz
457
464
End Property
458
465
459
466
Public Property Let Name(ByVal value As Variant)
460
467
fizz = value
461
468
End Property
462
469
463
470
Public Property Set Name(ByVal value As Variant)
464
- fizz = value
471
+ Set fizz = value
465
472
End Property
466
473
" ; // note: VBE removes excess spaces
467
474
@@ -484,6 +491,7 @@ End Property
484
491
{
485
492
ImplementLetSetterType = true ,
486
493
ImplementSetSetterType = true ,
494
+ CanImplementLet = true ,
487
495
ParameterName = "value" ,
488
496
PropertyName = "Name"
489
497
} ;
@@ -542,6 +550,7 @@ End Property
542
550
{
543
551
ImplementLetSetterType = true ,
544
552
ImplementSetSetterType = false ,
553
+ CanImplementLet = true ,
545
554
ParameterName = "value" ,
546
555
PropertyName = "Name"
547
556
} ;
@@ -600,6 +609,7 @@ End Property
600
609
{
601
610
ImplementLetSetterType = true ,
602
611
ImplementSetSetterType = false ,
612
+ CanImplementLet = true ,
603
613
ParameterName = "value" ,
604
614
PropertyName = "Name"
605
615
} ;
@@ -655,6 +665,7 @@ End Property
655
665
{
656
666
ImplementLetSetterType = true ,
657
667
ImplementSetSetterType = false ,
668
+ CanImplementLet = true ,
658
669
ParameterName = "value" ,
659
670
PropertyName = "Name"
660
671
} ;
@@ -725,6 +736,7 @@ Sub Bar(ByVal name As Integer)
725
736
{
726
737
ImplementLetSetterType = true ,
727
738
ImplementSetSetterType = false ,
739
+ CanImplementLet = true ,
728
740
ParameterName = "value" ,
729
741
PropertyName = "Name"
730
742
} ;
@@ -814,6 +826,7 @@ Sub Bar(ByVal v As Integer)
814
826
{
815
827
ImplementLetSetterType = true ,
816
828
ImplementSetSetterType = false ,
829
+ CanImplementLet = true ,
817
830
ParameterName = "value" ,
818
831
PropertyName = "Name"
819
832
} ;
@@ -873,6 +886,7 @@ End Property
873
886
{
874
887
ImplementLetSetterType = true ,
875
888
ImplementSetSetterType = false ,
889
+ CanImplementLet = true ,
876
890
ParameterName = "value" ,
877
891
PropertyName = "Name"
878
892
} ;
@@ -889,7 +903,7 @@ End Property
889
903
}
890
904
891
905
[ TestMethod ]
892
- public void RemoveParams_PresenterIsNull ( )
906
+ public void EncapsulateField_PresenterIsNull ( )
893
907
{
894
908
//Input
895
909
const string inputCode =
@@ -917,7 +931,7 @@ public void RemoveParams_PresenterIsNull()
917
931
}
918
932
919
933
[ TestMethod ]
920
- public void RemoveParams_ModelIsNull ( )
934
+ public void EncapsulateField_ModelIsNull ( )
921
935
{
922
936
//Input
923
937
const string inputCode =
@@ -1133,6 +1147,36 @@ public void Presenter_Accept_ReturnsModelWithPropertyNameChanged()
1133
1147
Assert . AreEqual ( "MyProperty" , presenter . Show ( ) . PropertyName ) ;
1134
1148
}
1135
1149
1150
+ [ TestMethod ]
1151
+ public void Presenter_Accept_ReturnsModelWithCanImplementLetChanged ( )
1152
+ {
1153
+ //Input
1154
+ const string inputCode =
1155
+ @"Private fizz As Variant" ;
1156
+ var selection = new Selection ( 1 , 15 , 1 , 15 ) ;
1157
+
1158
+ //Arrange
1159
+ var builder = new MockVbeBuilder ( ) ;
1160
+ VBComponent component ;
1161
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component , selection ) ;
1162
+ var mockHost = new Mock < IHostApplication > ( ) ;
1163
+ mockHost . SetupAllProperties ( ) ;
1164
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( new Mock < ISinks > ( ) . Object ) ) ;
1165
+
1166
+ parser . Parse ( new CancellationTokenSource ( ) ) ;
1167
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
1168
+
1169
+ var view = new Mock < IEncapsulateFieldDialog > ( ) ;
1170
+ view . SetupProperty ( v => v . CanImplementLetSetterType , true ) ;
1171
+ view . Setup ( v => v . ShowDialog ( ) ) . Returns ( DialogResult . OK ) ;
1172
+
1173
+ var factory = new EncapsulateFieldPresenterFactory ( vbe . Object , parser . State , view . Object ) ;
1174
+
1175
+ var presenter = factory . Create ( ) ;
1176
+
1177
+ Assert . AreEqual ( true , presenter . Show ( ) . CanImplementLet ) ;
1178
+ }
1179
+
1136
1180
[ TestMethod ]
1137
1181
public void Presenter_Accept_ReturnsModelWithImplementLetChanged ( )
1138
1182
{
0 commit comments