Esempio n. 1
0
    public void WriteHtmlLiteral_WithinMaxSize_WritesSingleLiteral()
    {
        // Arrange
        var codeWriter = new CodeWriter();
        var writer     = new RuntimeNodeWriter();
        var context    = TestCodeRenderingContext.CreateRuntime();

        // Act
        writer.WriteHtmlLiteral(context, maxStringLiteralLength: 6, "Hello");

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

        Assert.Equal(
            @"WriteLiteral(""Hello"");
",
            csharp,
            ignoreLineEndingDifferences: true);
    }
Esempio n. 2
0
    public void WriteHtmlLiteral_GreaterThanMaxSize_SingleEmojisSplit()
    {
        // Arrange
        var codeWriter = new CodeWriter();
        var writer     = new RuntimeNodeWriter();
        var context    = TestCodeRenderingContext.CreateRuntime();

        // Act
        writer.WriteHtmlLiteral(context, maxStringLiteralLength: 2, " 👦");

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

        Assert.Equal(
            @"WriteLiteral("" "");
WriteLiteral(""👦"");
",
            csharp,
            ignoreLineEndingDifferences: true);
    }