@@ -36,14 +36,12 @@ public async Task StartAsync_NotifiesListenersOfExistingRazorFiles()
36
36
. Callback ( ( string filePath , RazorFileChangeKind kind , CancellationToken _ ) => args2 . Add ( ( filePath , kind ) ) ) ;
37
37
38
38
ImmutableArray < string > existingRazorFiles = [ "c:/path/to/index.razor" , "c:/other/path/_Host.cshtml" ] ;
39
- using var cts = new CancellationTokenSource ( ) ;
40
39
using var detector = new InitializationSkippingRazorFileChangeDetector (
41
- cts ,
42
40
[ listenerMock1 . Object , listenerMock2 . Object ] ,
43
41
existingRazorFiles ) ;
44
42
45
43
// Act
46
- await detector . StartAsync ( "/some/workspacedirectory" , cts . Token ) ;
44
+ await detector . StartAsync ( "/some/workspacedirectory" , DisposalToken ) ;
47
45
48
46
// Assert
49
47
Assert . Collection ( args1 ,
@@ -122,22 +120,14 @@ private class TestRazorFileChangeDetector(
122
120
}
123
121
124
122
private class InitializationSkippingRazorFileChangeDetector (
125
- CancellationTokenSource initializationTokenSource ,
126
123
IEnumerable < IRazorFileChangeListener > listeners ,
127
124
ImmutableArray < string > existingProjectFiles ) : RazorFileChangeDetector ( listeners )
128
125
{
129
- private readonly CancellationTokenSource _initializationTokenSource = initializationTokenSource ;
130
126
private readonly ImmutableArray < string > _existingProjectFiles = existingProjectFiles ;
131
127
132
- protected override void OnInitializationFinished ( )
133
- {
134
- // Once initialization has finished we want to ensure that no file watchers are created so cancel!
135
- _initializationTokenSource . Cancel ( ) ;
136
- }
128
+ protected override bool InitializeFileWatchers => false ;
137
129
138
130
protected override ImmutableArray < string > GetExistingRazorFiles ( string workspaceDirectory )
139
- {
140
- return _existingProjectFiles ;
141
- }
131
+ => _existingProjectFiles ;
142
132
}
143
133
}
0 commit comments