コード例 #1
0
        public void GetPreciseIssueLocations_Xml()
        {
            var code   = @"<Root>
<Space><SelfClosing /></Space>
<!--   ^^^^^^^^^^^^^^^ -->
<NoSpace><SelfClosing /></NoSpace>
     <!--^^^^^^^^^^^^^^^-->
<Multiline><SelfClosing /></Multiline>
<!--       ^^^^^^^^^^^^^^^
-->
</Root>";
            var line   = GetLine(2, code);
            var result = new IssueLocationCollector().GetPreciseIssueLocations(line).ToList();

            result.Should().ContainSingle();
            var issueLocation = result.Single();

            issueLocation.Start.Should().Be(7);
            issueLocation.Length.Should().Be(15);

            line   = GetLine(4, code);
            result = new IssueLocationCollector().GetPreciseIssueLocations(line).ToList();
            result.Should().ContainSingle();
            issueLocation = result.Single();
            issueLocation.Start.Should().Be(9);
            issueLocation.Length.Should().Be(15);

            line   = GetLine(6, code);
            result = new IssueLocationCollector().GetPreciseIssueLocations(line).ToList();
            result.Should().ContainSingle();
            issueLocation = result.Single();
            issueLocation.Start.Should().Be(11);
            issueLocation.Length.Should().Be(15);
        }