コード例 #1
0
ファイル: BlockTest.cs プロジェクト: lodejard/AllNetCore
        public void LocateOwnerReturnsNullIfChangeCrossesMultipleSpans()
        {
            // Arrange
            var factory = SpanFactory.CreateCsHtml();
            var block   = new MarkupBlock(
                factory.Markup("Foo "),
                new StatementBlock(
                    factory.CodeTransition(),
                    factory.Code("bar").AsStatement()),
                factory.Markup(" Baz"));
            var change = new TextChange(4, 10, new StringTextBuffer("Foo @bar Baz"), 10, new StringTextBuffer("Foo @bor Baz"));

            // Act
            var actual = block.LocateOwner(change);

            // Assert
            Assert.Null(actual);
        }
コード例 #2
0
        public void LocateOwnerReturnsNullIfNoSpanReturnsTrueForOwnsSpan()
        {
            // Arrange
            var   factory = SpanFactory.CreateCsHtml();
            Block block   = new MarkupBlock(
                factory.Markup("Foo "),
                new StatementBlock(
                    factory.CodeTransition(),
                    factory.Code("bar").AsStatement()),
                factory.Markup(" Baz"));
            TextChange change = new TextChange(128, 1, new StringTextBuffer("Foo @bar Baz"), 1, new StringTextBuffer("Foo @bor Baz"));

            // Act
            Span actual = block.LocateOwner(change);

            // Assert
            Assert.Null(actual);
        }
コード例 #3
0
ファイル: BlockTest.cs プロジェクト: yts111/ASP.NET-Mvc-3
        public void LocateOwnerReturnsSpanWhichReturnsTrueForOwnsSpan()
        {
            // Arrange
            Span  expected = new CodeSpan(new SourceLocation(5, 0, 5), "bar");
            Block block    = new MarkupBlock(new SyntaxTreeNode[] {
                new MarkupSpan(SourceLocation.Zero, "Foo "),
                new StatementBlock(new SyntaxTreeNode[] {
                    new TransitionSpan(new SourceLocation(4, 0, 4), "@"),
                    expected,
                }),
                new MarkupSpan(new SourceLocation(8, 0, 8), " Baz")
            });
            TextChange change = new TextChange(6, 1, new StringTextBuffer("Foo @bar Baz"), 1, new StringTextBuffer("Foo @bor Baz"));

            // Act
            Span actual = block.LocateOwner(change);

            // Assert
            Assert.AreSame(expected, actual);
        }