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");
        }
        public void ActiveSolutionTracker_RaiseEventOnSolutionClose()
        {
            // Arrange
            int counter     = 0;
            var testSubject = new ActiveSolutionTracker(this.serviceProvider);

            testSubject.ActiveSolutionChanged += (o, e) => counter++;

            // Act
            this.solutionMock.SimulateSolutionClose();

            // Assert
            counter.Should().Be(1, nameof(testSubject.ActiveSolutionChanged) + " was expected to be raised");
        }
        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");
        }
        public void ActiveSolutionTracker_RaiseEventOnSolutionOpen()
        {
            // Arrange
            int counter = 0;
            bool isSolutionOpenArg = false;
            var testSubject = new ActiveSolutionTracker(this.serviceProvider);
            testSubject.ActiveSolutionChanged += (o, e) => { counter++; isSolutionOpenArg = e.IsSolutionOpen; };

            // Act
            this.solutionMock.SimulateSolutionOpen();

            // Assert
            counter.Should().Be(1, nameof(testSubject.ActiveSolutionChanged) + " was expected to be raised");
            isSolutionOpenArg.Should().BeTrue();
        }
        public void ActiveSolutionTracker_Dispose()
        {
            // Arrange
            int counter = 0;
            var testSubject = new ActiveSolutionTracker(this.serviceProvider);
            testSubject.ActiveSolutionChanged += (o, e) => counter++;
            testSubject.Dispose();

            // Act
            this.solutionMock.SimulateSolutionClose();
            this.solutionMock.SimulateSolutionOpen();

            // Assert
            counter.Should().Be(0, nameof(testSubject.ActiveSolutionChanged) + " was not expected to be raised since disposed");
        }
        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");
        }
        public void ActiveSolutionTracker_DontRaiseEventOnProjectChanges()
        {
            // Arrange
            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);

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