private bool ShouldInclude(DiagnosticData diagnostic) { return(diagnostic.DocumentId == _document.Id && _range.IntersectsWith(diagnostic.GetTextSpan()) && (_includeSuppressedDiagnostics || !diagnostic.IsSuppressed) && (_diagnosticId == null || _diagnosticId == diagnostic.Id)); }
private static void AssertDiagnostics(DiagnosticData item1, DiagnosticData item2) { Assert.Equal(item1.Id, item2.Id); Assert.Equal(item1.Category, item2.Category); Assert.Equal(item1.Message, item2.Message); Assert.Equal(item1.ENUMessageForBingSearch, item2.ENUMessageForBingSearch); Assert.Equal(item1.Severity, item2.Severity); Assert.Equal(item1.IsEnabledByDefault, item2.IsEnabledByDefault); Assert.Equal(item1.WarningLevel, item2.WarningLevel); Assert.Equal(item1.DefaultSeverity, item2.DefaultSeverity); Assert.Equal(item1.CustomTags.Length, item2.CustomTags.Length); for (var j = 0; j < item1.CustomTags.Length; j++) { Assert.Equal(item1.CustomTags[j], item2.CustomTags[j]); } Assert.Equal(item1.Properties.Count, item2.Properties.Count); Assert.True(item1.Properties.SetEquals(item2.Properties)); Assert.Equal(item1.ProjectId, item2.ProjectId); Assert.Equal(item1.DocumentId, item2.DocumentId); Assert.Equal(item1.HasTextSpan, item2.HasTextSpan); if (item1.HasTextSpan) { Assert.Equal(item1.GetTextSpan(), item2.GetTextSpan()); } Assert.Equal(item1.DataLocation?.MappedFilePath, item2.DataLocation?.MappedFilePath); Assert.Equal(item1.DataLocation?.MappedStartLine, item2.DataLocation?.MappedStartLine); Assert.Equal( item1.DataLocation?.MappedStartColumn, item2.DataLocation?.MappedStartColumn ); Assert.Equal(item1.DataLocation?.MappedEndLine, item2.DataLocation?.MappedEndLine); Assert.Equal(item1.DataLocation?.MappedEndColumn, item2.DataLocation?.MappedEndColumn); Assert.Equal( item1.DataLocation?.OriginalFilePath, item2.DataLocation?.OriginalFilePath ); Assert.Equal( item1.DataLocation?.OriginalStartLine, item2.DataLocation?.OriginalStartLine ); Assert.Equal( item1.DataLocation?.OriginalStartColumn, item2.DataLocation?.OriginalStartColumn ); Assert.Equal(item1.DataLocation?.OriginalEndLine, item2.DataLocation?.OriginalEndLine); Assert.Equal( item1.DataLocation?.OriginalEndColumn, item2.DataLocation?.OriginalEndColumn ); Assert.Equal(item1.Description, item2.Description); Assert.Equal(item1.HelpLink, item2.HelpLink); }