public void CppCheckError_MinimalErrorCanBeConvertedToSarifIssue() { Result result = new CppCheckError("id", "message", "verbose", "style", _dummyLocations) .ToSarifIssue(); Assert.Equal("id", result.RuleId); Assert.Equal("verbose", result.Message.Text); result.PropertyNames.Count.Should().Be(1); result.GetProperty("Severity").Should().Be("style"); Assert.Equal("file.cpp", result.Locations.First().PhysicalLocation.ArtifactLocation.Uri.ToString()); }
public void CppCheckError_ErrorWithSingleLocationIsConvertedToSarifIssue() { Result result = new CppCheckError("id", "message", "verbose", "my fancy severity", ImmutableArray.Create( new CppCheckLocation("foo.cpp", 1234) )).ToSarifIssue(); Assert.AreEqual("id", result.RuleId); Assert.AreEqual("verbose", result.Message); result.PropertyNames.Count.Should().Be(1); result.GetProperty("Severity").Should().Be("my fancy severity"); result.Locations.SequenceEqual(new[] { new Location { ResultFile = new PhysicalLocation { Uri = new Uri("foo.cpp", UriKind.RelativeOrAbsolute), Region = new Region { StartLine = 1234 } } } }, Location.ValueComparer).Should().BeTrue(); Assert.IsNull(result.CodeFlows); }
public void CppCheckError_MinimalErrorCanBeConvertedToSarifIssue() { Result result = new CppCheckError("id", "message", "verbose", "style", _dummyLocations) .ToSarifIssue(); Assert.AreEqual("id", result.RuleId); Assert.AreEqual("verbose", result.Message); result.PropertyNames.Count.Should().Be(1); result.GetProperty("Severity").Should().Be("style"); Assert.AreEqual("file.cpp", result.Locations.First().ResultFile.Uri.ToString()); }
public void CppCheckError_ErrorWithSingleLocationIsConvertedToSarifIssue() { Result result = new CppCheckError("id", "message", "verbose", "my fancy severity", ImmutableArray.Create( new CppCheckLocation("foo.cpp", 1234) )).ToSarifIssue(); Assert.AreEqual("id", result.RuleId); Assert.AreEqual("verbose", result.Message); result.PropertyNames.Count.Should().Be(1); result.GetProperty("Severity").Should().Be("my fancy severity"); result.Locations.SequenceEqual(new[] { new Location { ResultFile = new PhysicalLocation { Uri = new Uri("foo.cpp", UriKind.RelativeOrAbsolute), Region = new Region { StartLine = 1234 } } } }, Location.ValueComparer).Should().BeTrue(); Assert.IsNull(result.CodeFlows); }