Skip to content

Context Conditional not working in Nancy #4

Description

@thecopy

This SSVE markup:

@Context.ViewBag.HaveMessage;<br />
@If.Context.ViewBag.HaveMessage;
    Yay Message!
@EndIf;

Produces in Nancy:

True

Produces in SSVE test:

True
Yay Message!
[Fact]
public void Should_evaluate_context_conditional()
{
    const string input = @"@Context.ViewBag.HaveMessage;! @If.Context.ViewBag.HaveMessage;Yay message!@EndIf;";
    var context = new { ViewBag = (dynamic)new ExpandoObject() };
    context.ViewBag.HaveMessage = true;

    ((FakeViewEngineHost)this.fakeHost).Context = context;

    var output = viewEngine.Render(input, null, this.fakeHost);

    Assert.Equal(@"True! Yay message!", output);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions