@@ -182,6 +182,44 @@ await _projectService.UpdateProjectAsync(
182
182
Assert . Empty ( miscProject . DocumentFilePaths ) ;
183
183
}
184
184
185
+ [ Fact ]
186
+ public async Task UpdateProject_MovesDocumentsFromMisc_ViaService ( )
187
+ {
188
+ // Arrange
189
+ const string DocumentFilePath = "C:/path/to/file.cshtml" ;
190
+ const string ProjectFilePath = "C:/path/to/project.csproj" ;
191
+ const string IntermediateOutputPath = "C:/path/to/obj" ;
192
+ const string RootNamespace = "TestRootNamespace" ;
193
+
194
+ var ownerProjectKey = await _projectService . AddProjectAsync (
195
+ ProjectFilePath , IntermediateOutputPath , RazorConfiguration . Default , RootNamespace , displayName : null , DisposalToken ) ;
196
+
197
+ await _projectService . AddDocumentToMiscProjectAsync ( DocumentFilePath , DisposalToken ) ;
198
+
199
+ var miscProject = await _snapshotResolver . GetMiscellaneousProjectAsync ( DisposalToken ) ;
200
+
201
+ var project = _projectManager . GetLoadedProject ( ownerProjectKey ) ;
202
+
203
+ var addedDocument = new DocumentSnapshotHandle ( DocumentFilePath , DocumentFilePath , FileKinds . Legacy ) ;
204
+
205
+ // Act
206
+ await _projectService . UpdateProjectAsync (
207
+ project . Key ,
208
+ project . Configuration ,
209
+ project . RootNamespace ,
210
+ project . DisplayName ,
211
+ ProjectWorkspaceState . Default ,
212
+ [ addedDocument ] ,
213
+ DisposalToken ) ;
214
+
215
+ // Assert
216
+ project = _projectManager . GetLoadedProject ( ownerProjectKey ) ;
217
+ var projectFilePaths = project . DocumentFilePaths . OrderBy ( path => path ) ;
218
+ Assert . Equal ( projectFilePaths , [ addedDocument . FilePath ] ) ;
219
+ miscProject = _projectManager . GetLoadedProject ( miscProject . Key ) ;
220
+ Assert . Empty ( miscProject . DocumentFilePaths ) ;
221
+ }
222
+
185
223
[ Fact ]
186
224
public async Task UpdateProject_MovesExistingDocumentToMisc ( )
187
225
{
0 commit comments