Пример #1
0
        public void IsCSharpOpenCurlyBrace_Blocks_ReturnFalse()
        {
            // Arrange
            var child = SyntaxFactory.MarkupBlock();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
        public void IsCSharpOpenCurlyBrace_SpanWithHtmlSymbol_ReturnFalse()
        {
            // Arrange
            var childBuilder = new SpanBuilder(SourceLocation.Zero);
            childBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello"));
            var child = childBuilder.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
        public void IsCSharpOpenCurlyBrace_SpanWithLeftBrace_ReturnTrue()
        {
            // Arrange
            var childBuilder = new SpanBuilder(SourceLocation.Zero);
            childBuilder.Accept(SyntaxFactory.Token(SyntaxKind.LeftBrace, "{"));
            var child = childBuilder.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.True(result);
        }
Пример #4
0
        public void IsCSharpOpenCurlyBrace_SpanWithHtmlSymbol_ReturnFalse()
        {
            // Arrange
            var builder = SyntaxListBuilder <SyntaxToken> .Create();

            builder.Add(SyntaxFactory.Token(SyntaxKind.Text, "hello"));
            var child = SyntaxFactory.MarkupTextLiteral(builder.ToList());

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
Пример #5
0
        public void IsCSharpOpenCurlyBrace_SpanWithLeftBrace_ReturnTrue()
        {
            // Arrange
            var builder = SyntaxListBuilder <SyntaxToken> .Create();

            builder.Add(SyntaxFactory.Token(SyntaxKind.LeftBrace, "{"));
            var child = SyntaxFactory.RazorMetaCode(builder.ToList());

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.True(result);
        }
        public void IsCSharpOpenCurlyBrace_Blocks_ReturnFalse()
        {
            // Arrange
            var child = new BlockBuilder()
            {
                Type = BlockKindInternal.Markup,
            }.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
Пример #7
0
        public void IsCSharpOpenCurlyBrace_SpanWithLeftBrace_ReturnTrue()
        {
            // Arrange
            var childBuilder = new SpanBuilder(SourceLocation.Zero);

            childBuilder.Accept(new CSharpSymbol("{", CSharpSymbolType.LeftBrace));
            var child = childBuilder.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.True(result);
        }
        public void IsCSharpOpenCurlyBrace_SpanWithUnsupportedSymbolType_ReturnFalse(string content, object symbolTypeObject)
        {
            // Arrange
            var symbolType = (SyntaxKind)symbolTypeObject;
            var childBuilder = new SpanBuilder(SourceLocation.Zero);
            childBuilder.Accept(SyntaxFactory.Token(symbolType, content));
            var child = childBuilder.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
Пример #9
0
        public void IsCSharpOpenCurlyBrace_SpanWithUnsupportedSymbolType_ReturnFalse(string content, object symbolTypeObject)
        {
            // Arrange
            var symbolType = (SyntaxKind)symbolTypeObject;
            var builder    = SyntaxListBuilder <SyntaxToken> .Create();

            builder.Add(SyntaxFactory.Token(symbolType, content));
            var child = SyntaxFactory.MarkupTextLiteral(builder.ToList());

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }
        public void IsCSharpOpenCurlyBrace_MultipleSymbols_ReturnFalse()
        {
            // Arrange
            var childBuilder = new SpanBuilder(SourceLocation.Zero);

            childBuilder.Accept(new CSharpToken("hello", CSharpTokenType.Identifier));
            childBuilder.Accept(new CSharpToken(",", CSharpTokenType.Comma));
            var child = childBuilder.Build();

            // Act
            var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child);

            // Assert
            Assert.False(result);
        }