Inheritance: IActiveSolutionTracker, IVsSolutionEvents, IDisposable
コード例 #1
0
        public void ActiveSolutionTracker_RaiseEventOnSolutionClose()
        {
            // Setup
            int counter = 0;
            var testSubject = new ActiveSolutionTracker(this.serviceProvider);
            testSubject.ActiveSolutionChanged += (o, e) => counter++;

            // Act
            this.solutionMock.SimulateSolutionClose();

            // Verify
            Assert.AreEqual(1, counter, nameof(testSubject.ActiveSolutionChanged) + " was expected to be raised");
        }
コード例 #2
0
        public void ActiveSolutionTracker_DontRaiseEventOnProjectChanges()
        {
            // Setup
            int counter = 0;
            var testSubject = new ActiveSolutionTracker(this.serviceProvider);
            testSubject.ActiveSolutionChanged += (o, e) => counter++;
            var project = this.solutionMock.AddOrGetProject("project", isLoaded:false);

            // Act
            this.solutionMock.SimulateProjectLoad(project);
            this.solutionMock.SimulateProjectUnload(project);
            this.solutionMock.SimulateProjectOpen(project);
            this.solutionMock.SimulateProjectClose(project);

            // Verify
            Assert.AreEqual(0, counter, nameof(testSubject.ActiveSolutionChanged) + " was not expected to be raised");
        }