private void OnIssuesChanged(object sender, IssuesChangedEventArgs e) { if (!e.AnalyzedFiles.Contains(GetCurrentFilePath(), StringComparer.OrdinalIgnoreCase)) { return; // no changes in this file } UpdateTags(); }
public void IssueStoresChanged_HasSubscribersToIssuesChangedEvent_SubscribersNotified() { var issueStore1 = new Mock <IIssuesStore>(); var issueStore2 = new Mock <IIssuesStore>(); var testSubject = CreateTestSubject(issueStore1.Object, issueStore2.Object); IssuesChangedEventArgs suppliedArgs = null; var eventCount = 0; testSubject.IssuesChanged += (sender, args) => { suppliedArgs = args; eventCount++; }; var location1 = CreateLocation("b.cpp"); var location2 = CreateLocation("B.cpp"); var issueViz1 = CreateIssueViz("a.cpp", location1, location2); RaiseIssuesChangedEvent(issueStore1, newIssues: new[] { issueViz1 }); eventCount.Should().Be(1); suppliedArgs.Should().NotBeNull(); suppliedArgs.AnalyzedFiles.Should().BeEquivalentTo("a.cpp", "b.cpp"); var issueViz2 = CreateIssueViz("c.cpp"); eventCount = 0; RaiseIssuesChangedEvent(issueStore2, newIssues: new[] { issueViz2 }); eventCount.Should().Be(1); suppliedArgs.Should().NotBeNull(); suppliedArgs.AnalyzedFiles.Should().BeEquivalentTo("c.cpp"); eventCount = 0; RaiseIssuesChangedEvent(issueStore2, oldIssues: new[] { issueViz1 }, newIssues: new[] { issueViz2 }); eventCount.Should().Be(1); suppliedArgs.Should().NotBeNull(); suppliedArgs.AnalyzedFiles.Should().BeEquivalentTo("a.cpp", "b.cpp", "c.cpp"); }