public void WriteCSharpExpression_SkipsLinePragma_WithoutSource()
        {
            // Arrange
            var writer  = new DesignTimeNodeWriter();
            var context = TestCodeRenderingContext.CreateDesignTime();

            var node    = new CSharpExpressionIntermediateNode();
            var builder = IntermediateNodeBuilder.Create(node);

            builder.Add(new IntermediateToken()
            {
                Content = "i++",
                Kind    = TokenKind.CSharp,
            });

            // Act
            writer.WriteCSharpExpression(context, node);

            // Assert
            var csharp = context.CodeWriter.GenerateCode();

            Assert.Equal(
                @"__o = i++;
",
                csharp,
                ignoreLineEndingDifferences: true);
        }
        public void WriteCSharpExpression_WritesLinePragma_WithSource()
        {
            // Arrange
            var writer  = new DesignTimeNodeWriter();
            var context = TestCodeRenderingContext.CreateDesignTime();

            var node = new CSharpExpressionIntermediateNode()
            {
                Source = new SourceSpan("test.cshtml", 0, 0, 0, 3),
            };
            var builder = IntermediateNodeBuilder.Create(node);

            builder.Add(new IntermediateToken()
            {
                Content = "i++",
                Kind    = TokenKind.CSharp,
            });

            // Act
            writer.WriteCSharpExpression(context, node);

            // Assert
            var csharp = context.CodeWriter.GenerateCode();

            Assert.Equal(
                @"#line 1 ""test.cshtml""
__o = i++;

#line default
#line hidden
",
                csharp,
                ignoreLineEndingDifferences: true);
        }