Example #1
0
        public void SarifErrorListItem_WhenRegionIsAbsent_HasNoLineMarker()
        {
            var item = new SarifErrorListItem
            {
                FileName = "file.ext",
            };

            ResultTextMarker lineMarker = item.LineMarker;

            lineMarker.Should().Be(null);
        }
Example #2
0
        public void SarifErrorListItem_WhenRegionHasStartLine_HasLineMarker()
        {
            var item = new SarifErrorListItem
            {
                FileName = "file.ext",
                Region   = new Region
                {
                    StartLine = 5,
                },
            };

            ResultTextMarker lineMarker = item.LineMarker;

            lineMarker.Should().NotBe(null);
        }
Example #3
0
        public void SarifErrorListItem_WhenRegionHasNoStartLine_HasNoLineMarker()
        {
            var item = new SarifErrorListItem
            {
                FileName = "file.ext",
                Region   = new Region
                {
                    ByteOffset = 20,
                },
            };

            ResultTextMarker lineMarker = item.LineMarker;

            lineMarker.Should().Be(null);
        }
        public void SarifErrorListItem_WithXamlProperty_ContainsXamlMessage()
        {
            var result = new Result
            {
                Message = new Message
                {
                    Text = "Message to be a tooltip.",
                },
                RuleId    = "TST0001",
                Locations = new[]
                {
                    new Location
                    {
                        PhysicalLocation = new PhysicalLocation
                        {
                            Region = new Region
                            {
                                StartLine   = 10,
                                StartColumn = 6,
                            },
                        },
                    },
                },
            };

            result.Message.SetProperty(SarifErrorListItem.XamlPropertyName, ValidXamlWithHyperlink);

            var run = new Run
            {
                Tool = new Tool(),
            };

            SarifErrorListItem item = TestUtilities.MakeErrorListItem(run, result);

            item.Message.Should().Be(result.Message.Text);
            item.XamlMessage.Should().Be(ValidXamlWithHyperlink);

            ResultTextMarker lineMarker = item.LineMarker;

            lineMarker.ToolTipContent.Should().Be(result.Message.Text);
            lineMarker.ToolTipXamlString.Should().Be(ValidXamlWithHyperlink);
        }