Example #1
0
        public void IsTagHelperSpan_NullSyntaxTree_ReturnsFalse()
        {
            // Arrange
            var location = new SourceSpan(0, 4);
            var service  = new DefaultRazorSyntaxFactsService();

            // Act
            var result = service.IsTagHelperSpan(null, location);

            // Assert
            Assert.False(result);
        }
Example #2
0
        public void IsTagHelperSpan_ReturnsTrue()
        {
            // Arrange
            var syntaxTree = GetSyntaxTree(
                @"<div>
    <taghelper />
</div>");
            var location = new SourceSpan(9 + Environment.NewLine.Length, 13);
            var service  = new DefaultRazorSyntaxFactsService();

            // Act
            var result = service.IsTagHelperSpan(syntaxTree, location);

            // Assert
            Assert.True(result);
        }
Example #3
0
        public void IsTagHelperSpan_ReturnsFalse()
        {
            // Arrange
            var syntaxTree = GetSyntaxTree(
                @"<div>
    <taghelper></taghelper>
</div>");
            var location = new SourceSpan(0, 4);
            var service  = new DefaultRazorSyntaxFactsService();

            // Act
            var result = service.IsTagHelperSpan(syntaxTree, location);

            // Assert
            Assert.False(result);
        }
        public void IsTagHelperSpan_ReturnsTrue()
        {
            var str =
                @"<div>
    <taghelper />
</div>";

            // Arrange
            var syntaxTree = GetSyntaxTree(str);

            var location = new SourceSpan(str.IndexOf("tag", StringComparison.Ordinal) - 1, 13);
            var service  = new DefaultRazorSyntaxFactsService();

            // Act
            var result = service.IsTagHelperSpan(syntaxTree, location);

            // Assert
            Assert.True(result);
        }