public async Task Changed_TriggersOnSnapshotManagerChanged() { // Arrange var projectSnapshotManager = new TestProjectSnapshotManager(ProjectSnapshot1); using var proxy = new DefaultProjectSnapshotManagerProxy( new TestCollaborationSession(true), Dispatcher, projectSnapshotManager, JoinableTaskFactory); var changedArgs = new ProjectChangeEventArgs(ProjectSnapshot1, ProjectSnapshot1, ProjectChangeKind.ProjectChanged); var called = false; proxy.Changed += (sender, args) => { called = true; Assert.Equal($"vsls:/path/to/project1.csproj", args.ProjectFilePath.ToString()); Assert.Equal(ProjectProxyChangeKind.ProjectChanged, args.Kind); Assert.Equal("vsls:/path/to/project1.csproj", args.Newer.FilePath.ToString()); }; // Act projectSnapshotManager.TriggerChanged(changedArgs); await proxy._processingChangedEventTestTask.JoinAsync(); // Assert Assert.True(called); }
public void Changed_NoopsIfProxyDisposed() { // Arrange var projectSnapshotManager = new TestProjectSnapshotManager(ProjectSnapshot1); var proxy = new DefaultProjectSnapshotManagerProxy( new TestCollaborationSession(true), Dispatcher, projectSnapshotManager, JoinableTaskFactory); var changedArgs = new ProjectChangeEventArgs(ProjectSnapshot1, ProjectSnapshot1, ProjectChangeKind.ProjectChanged); proxy.Changed += (sender, args) => throw new InvalidOperationException("Should not have been called."); proxy.Dispose(); // Act projectSnapshotManager.TriggerChanged(changedArgs); // Assert Assert.Null(proxy._processingChangedEventTestTask); }