@@ -29,8 +29,6 @@ public void PicksUpComments()
29
29
' Bug this is a bug comment
30
30
" ;
31
31
32
- var selectionService = new Mock < ISelectionService > ( ) . Object ;
33
-
34
32
var builder = new MockVbeBuilder ( ) ;
35
33
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
36
34
. AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
@@ -41,7 +39,7 @@ public void PicksUpComments()
41
39
using ( var state = parser . State )
42
40
{
43
41
var cs = GetConfigService ( new [ ] { "TODO" , "NOTE" , "BUG" } ) ;
44
- var vm = new ToDoExplorerViewModel ( state , cs , null , selectionService , GetMockedUiDispatcher ( ) ) ;
42
+ var vm = ArrangeViewModel ( state , cs ) ;
45
43
46
44
parser . Parse ( new CancellationTokenSource ( ) ) ;
47
45
if ( state . Status >= ParserState . Error )
@@ -66,8 +64,6 @@ public void PicksUpComments_StrangeCasing()
66
64
' bUg this is a bug comment
67
65
" ;
68
66
69
- var selectionService = new Mock < ISelectionService > ( ) . Object ;
70
-
71
67
var builder = new MockVbeBuilder ( ) ;
72
68
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
73
69
. AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
@@ -78,7 +74,7 @@ public void PicksUpComments_StrangeCasing()
78
74
using ( var state = parser . State )
79
75
{
80
76
var cs = GetConfigService ( new [ ] { "TODO" , "NOTE" , "BUG" } ) ;
81
- var vm = new ToDoExplorerViewModel ( state , cs , null , selectionService , GetMockedUiDispatcher ( ) ) ;
77
+ var vm = ArrangeViewModel ( state , cs ) ;
82
78
83
79
parser . Parse ( new CancellationTokenSource ( ) ) ;
84
80
if ( state . Status >= ParserState . Error )
@@ -103,8 +99,6 @@ public void PicksUpComments_SpecialCharacters()
103
99
' bug: this should not be seen due to the colon
104
100
" ;
105
101
106
- var selectionService = new Mock < ISelectionService > ( ) . Object ;
107
-
108
102
var builder = new MockVbeBuilder ( ) ;
109
103
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
110
104
. AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
@@ -115,7 +109,7 @@ public void PicksUpComments_SpecialCharacters()
115
109
using ( var state = parser . State )
116
110
{
117
111
var cs = GetConfigService ( new [ ] { "TO-DO" , "N@TE" , "BUG " } ) ;
118
- var vm = new ToDoExplorerViewModel ( state , cs , null , selectionService , GetMockedUiDispatcher ( ) ) ;
112
+ var vm = ArrangeViewModel ( state , cs ) ;
119
113
120
114
parser . Parse ( new CancellationTokenSource ( ) ) ;
121
115
if ( state . Status >= ParserState . Error )
@@ -139,8 +133,6 @@ public void AvoidsFalsePositiveComments()
139
133
' Denoted
140
134
" ;
141
135
142
- var selectionService = new Mock < ISelectionService > ( ) . Object ;
143
-
144
136
var builder = new MockVbeBuilder ( ) ;
145
137
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
146
138
. AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
@@ -151,7 +143,7 @@ public void AvoidsFalsePositiveComments()
151
143
using ( var state = parser . State )
152
144
{
153
145
var cs = GetConfigService ( new [ ] { "TODO" , "NOTE" , "BUG" } ) ;
154
- var vm = new ToDoExplorerViewModel ( state , cs , null , selectionService , GetMockedUiDispatcher ( ) ) ;
146
+ var vm = ArrangeViewModel ( state , cs ) ;
155
147
156
148
parser . Parse ( new CancellationTokenSource ( ) ) ;
157
149
if ( state . Status >= ParserState . Error )
@@ -175,8 +167,6 @@ public void RemoveRemovesComment()
175
167
const string expected =
176
168
@"Dim d As Variant " ;
177
169
178
- var selectionService = new Mock < ISelectionService > ( ) . Object ;
179
-
180
170
var builder = new MockVbeBuilder ( ) ;
181
171
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
182
172
. AddComponent ( "Module1" , ComponentType . StandardModule , inputCode )
@@ -189,11 +179,8 @@ public void RemoveRemovesComment()
189
179
using ( var state = parser . State )
190
180
{
191
181
var cs = GetConfigService ( new [ ] { "TODO" , "NOTE" , "BUG" } ) ;
192
- var vm = new ToDoExplorerViewModel ( state , cs , null , selectionService , GetMockedUiDispatcher ( ) )
193
- {
194
- RefreshCommand = new ReparseCommand ( vbe . Object , new Mock < IConfigurationService < GeneralSettings > > ( ) . Object , state , null , null , null , vbeEvents . Object )
195
- } ;
196
-
182
+ var vm = ArrangeViewModel ( state , cs ) ;
183
+
197
184
parser . Parse ( new CancellationTokenSource ( ) ) ;
198
185
if ( state . Status >= ParserState . Error )
199
186
{
@@ -233,5 +220,10 @@ private IUiDispatcher GetMockedUiDispatcher()
233
220
dispatcher . Setup ( m => m . Invoke ( It . IsAny < Action > ( ) ) ) . Callback ( ( Action argument ) => argument . Invoke ( ) ) ;
234
221
return dispatcher . Object ;
235
222
}
223
+
224
+ private ToDoExplorerViewModel ArrangeViewModel ( RubberduckParserState state , IConfigurationService < Configuration > configService )
225
+ {
226
+ return new ToDoExplorerViewModel ( state , configService , null , GetMockedUiDispatcher ( ) , null ) ;
227
+ }
236
228
}
237
229
}
0 commit comments