Beispiel #1
0
        public void SpanLengthOfEmptyGroupShouldBeEqualToToStringLength()
        {
            // Arrange
            var target = new TestGroupNode();

            // Act
            var(_, Length) = target.GetSpan();

            // Assert
            Length.ShouldBe(target.ToString().Length);
        }
Beispiel #2
0
        public void SpanLengthOfGroupWithChildNodesShouldBeEqualToToStringLength()
        {
            // Arrange
            var childNodes = new List <RegexNode> {
                new CharacterNode('a'), new CharacterNode('b'), new CharacterNode('c')
            };
            var target = new TestGroupNode(childNodes);

            // Act
            var(_, Length) = target.GetSpan();

            // Assert
            Length.ShouldBe(target.ToString().Length);
        }
Beispiel #3
0
        public void SpanLengthOfGroupShouldIncludeChildNodesPrefix()
        {
            // Arrange
            var childNode = new CharacterNode('a')
            {
                Prefix = new CommentGroupNode("Comment")
            };
            var target = new TestGroupNode(childNode);

            // Act
            var(_, Length) = target.GetSpan();

            // Assert
            Length.ShouldBe(target.ToString().Length);
        }
Beispiel #4
0
        public void SpanLengthOfGroupShouldNotIncludeItsOwnPrefix()
        {
            // Arrange
            var prefix = new CommentGroupNode("Comment");
            var target = new TestGroupNode()
            {
                Prefix = prefix
            };

            // Act
            var(_, Length) = target.GetSpan();

            // Assert
            Length.ShouldBe(target.ToString().Length - prefix.ToString().Length);
        }