public void Workspace_WorkspaceChanged_GEndingRazorCSharpFile_Noops() { // Arrange var originalSolution = Workspace.CurrentSolution; var addedDocument = AddRoslynDocument(filePath: "/path/Leg.cshtml.cs"); var newSolution = Workspace.CurrentSolution; var workspaceChangeEventArgs = new WorkspaceChangeEventArgs( WorkspaceChangeKind.DocumentChanged, originalSolution, newSolution, addedDocument.Project.Id, addedDocument.Id); var processedPublisher = new PrecompiledRazorPageSuppressor(Workspace); // Act processedPublisher.Workspace_WorkspaceChanged(sender: null, workspaceChangeEventArgs); // Assert Assert.Same(newSolution, Workspace.CurrentSolution); }
public void Workspace_WorkspaceChanged_RazorTargetAssemblyInfo_RemovesDocument() { // Arrange var originalSolution = Workspace.CurrentSolution; var addedDocument = AddRoslynDocument(filePath: "/path/obj/Debug/netcoreapp3.0/TheApp.RazorTargetAssemblyInfo.cs"); var newSolution = Workspace.CurrentSolution; var workspaceChangeEventArgs = new WorkspaceChangeEventArgs( WorkspaceChangeKind.DocumentChanged, originalSolution, newSolution, addedDocument.Project.Id, addedDocument.Id); var processedPublisher = new PrecompiledRazorPageSuppressor(Workspace); // Act processedPublisher.Workspace_WorkspaceChanged(sender: null, workspaceChangeEventArgs); // Assert Assert.NotSame(newSolution, Workspace.CurrentSolution); var potentialDocument = Workspace.CurrentSolution.GetDocument(addedDocument.Id); Assert.Null(potentialDocument); }
public void Workspace_WorkspaceChanged_DynamicallyGeneratedDocuments_RemovesDocument(string extension) { // Arrange var originalSolution = Workspace.CurrentSolution; var addedDocument = AddRoslynDocument(filePath: "/path/obj/Debug/netcoreapp3.0/Razor/Index" + extension); var newSolution = Workspace.CurrentSolution; var workspaceChangeEventArgs = new WorkspaceChangeEventArgs( WorkspaceChangeKind.DocumentChanged, originalSolution, newSolution, addedDocument.Project.Id, addedDocument.Id); var processedPublisher = new PrecompiledRazorPageSuppressor(Workspace); // Act processedPublisher.Workspace_WorkspaceChanged(sender: null, workspaceChangeEventArgs); // Assert Assert.NotSame(newSolution, Workspace.CurrentSolution); var potentialDocument = Workspace.CurrentSolution.GetDocument(addedDocument.Id); Assert.Null(potentialDocument); }