@@ -18,23 +18,64 @@ public class ParameterCanBeByValInspectionTests
18
18
{
19
19
[ TestMethod ]
20
20
[ TestCategory ( "Inspections" ) ]
21
- public void ParameterCanBeByVal_NoResultForByValClassInProperty ( )
21
+ public void ParameterCanBeByVal_NoResultForByValObjectInInterfaceImplementationProperty ( )
22
22
{
23
- const string class1Code = @"
24
- Option Explicit
25
- Public Sub DoSomething()
26
- End sub
27
- " ;
23
+ const string modelCode = @"
24
+ Option Explicit
25
+ Public Property Get Foo() As Integer
26
+ Foo = 42
27
+ End Property
28
+ " ;
28
29
29
- const string inputCode =
30
- @"Public Property Set Foo(ByVal value As Class1)
31
- End Property" ;
30
+ const string interfaceCode = @"
31
+ Option Explicit
32
+
33
+ Public Property Get Model() As ModelClass
34
+ End Property
35
+
36
+ Public Property Set Model(ByVal value As ModelClass)
37
+ End Property
38
+
39
+ Public Property Get IsCancelled() As Boolean
40
+ End Property
41
+
42
+ Public Sub Show()
43
+ End Sub
44
+ " ;
45
+
46
+ const string implementationCode = @"
47
+ Option Explicit
48
+ Private Type TView
49
+ Model As MyModel
50
+ IsCancelled As Boolean
51
+ Validator As New NumKeyValidator
52
+ End Type
53
+ Private this As TView
54
+ Implements IView
55
+
56
+ Private Property Get IDailySalesView_IsCancelled() As Boolean
57
+ IDailySalesView_IsCancelled = this.IsCancelled
58
+ End Property
59
+
60
+ Private Property Set IDailySalesView_Model(ByVal value As DailySalesModel)
61
+ Set this.Model = value
62
+ End Property
63
+
64
+ Private Property Get IDailySalesView_Model() As DailySalesModel
65
+ Set IDailySalesView_Model = this.Model
66
+ End Property
67
+
68
+ Private Sub IDailySalesView_Show()
69
+ Me.Show vbModal
70
+ End Sub
71
+ " ;
32
72
33
73
//Arrange
34
74
var builder = new MockVbeBuilder ( ) ;
35
75
var vbe = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
36
- . AddComponent ( "Class1" , ComponentType . ClassModule , class1Code )
37
- . AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
76
+ . AddComponent ( "IView" , ComponentType . ClassModule , interfaceCode )
77
+ . AddComponent ( "MyModel" , ComponentType . ClassModule , modelCode )
78
+ . AddComponent ( "MyForm" , ComponentType . UserForm , implementationCode )
38
79
. MockVbeBuilder ( ) . Build ( ) ;
39
80
40
81
var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( vbe . Object ) ) ;
0 commit comments