示例#1
0
        public void CalculatePaddingForEmptySpanReturnsZero()
        {
            // Arrange
            RazorEngineHost host = CreateHost(designTime: true);

            Span span = new Span(new SpanBuilder());

            var paddingBuilder = new CSharpPaddingBuilder(host);

            // Act
            int padding = paddingBuilder.CalculatePadding(span, 0);

            // Assert
            Assert.Equal(0, padding);
        }
示例#2
0
        public void CalculatePaddingForIfSpanWith5Spaces(bool designTime, bool isIndentingWithTabs, int tabSize)
        {
            // Arrange
            RazorEngineHost host = CreateHost(designTime, isIndentingWithTabs, tabSize);

            Span span = GenerateSpan(@"    @if (true)", SpanKind.Code, 2, "if (true)");

            var paddingBuilder = new CSharpPaddingBuilder(host);

            // Act
            int padding = paddingBuilder.CalculatePadding(span, 1);

            // Assert
            Assert.Equal(4, padding);
        }
        public void CalculatePaddingForEmptySpanWith4Spaces(bool designTime, bool isIndentingWithTabs, int tabSize)
        {
            // Arrange
            var host = CreateHost(designTime, isIndentingWithTabs, tabSize);

            var span = GenerateSpan(@"    @{", SpanKind.Code, 3, "");

            var paddingBuilder = new CSharpPaddingBuilder(host);

            // Act
            var padding = paddingBuilder.CalculatePadding(span, 1);

            // Assert
            Assert.Equal(5, padding);
        }