From fa4f37d1bc0f3622d1aec859d61f7f8cfb043e06 Mon Sep 17 00:00:00 2001 From: "George Njeri (Swagfin)" Date: Wed, 8 Oct 2025 22:12:39 +0300 Subject: [PATCH] chore: multi-if statement blocks --- ObjectSemantics.NET.Tests/IfConditionTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ObjectSemantics.NET.Tests/IfConditionTests.cs b/ObjectSemantics.NET.Tests/IfConditionTests.cs index d250295..26666e8 100644 --- a/ObjectSemantics.NET.Tests/IfConditionTests.cs +++ b/ObjectSemantics.NET.Tests/IfConditionTests.cs @@ -112,5 +112,23 @@ public void Should_Evaluate_String_Conditions_If_Blocks(string name, string expe string result = person.Map(template); Assert.Equal(expected, result); } + + [Theory] + [InlineData(40, "[Adult]|[CanTakeAlcohol]")] + [InlineData(18, "[Adult]|[CanTakeAlcohol]")] + [InlineData(0, "[Minor]|[NoAlcohol]")] + [InlineData(-7, "[Minor]|[NoAlcohol]")] + public void Should_Render_Multiple_If_Condition_Statements(int age, string expected) + { + Person person = new Person + { + Age = age + }; + + string template = @"{{ #if(Age >= 18) }}[Adult]{{ #else }}[Minor]{{ #endif }}|{{ #if(Age < 18) }}[NoAlcohol]{{ #else }}[CanTakeAlcohol]{{ #endif }}"; + + string result = person.Map(template); + Assert.Equal(expected, result); + } } }