public async Task UnlessDoesntProcessWhenTrue()
        {
            var e = new UnlessStatement(
                TRUE,
                new[] { new TextStatement("x") }
                );

            var sw = new StringWriter();
            await e.WriteToAsync(sw, HtmlEncoder.Default, new TemplateContext());

            Assert.Equal("", sw.ToString());
        }
        public async Task IfCanProcessWhenFalse()
        {
            var e = new UnlessStatement(
                FALSE,
                new[] { new TextStatement("x") }
                );

            var sw = new StringWriter();
            await e.WriteToAsync(sw, HtmlEncoder.Default, new TemplateContext());

            Assert.Equal("x", sw.ToString());
        }
Exemple #3
0
        public async Task UnlessShouldProcessElseWhenFalse()
        {
            var e = new UnlessStatement(
                FALSE,
                new List <Statement> {
                new TextSpanStatement("x")
            },
                new ElseStatement(new List <Statement> {
                new TextSpanStatement("y")
            }));

            var sw = new StringWriter();
            await e.WriteToAsync(sw, HtmlEncoder.Default, new TemplateContext());

            Assert.Equal("x", sw.ToString());
        }