Skip to content

Commit

Permalink
Fix SemanticHasCondition always true problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrandvd committed Dec 28, 2023
1 parent 5f92485 commit 8167065
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SemanticValidation;
using skUnit.Exceptions;

namespace skUnit.Scenarios.Parsers.Assertions;

Expand All @@ -17,7 +18,10 @@ public class HasConditionAssertion : IKernelAssertion
/// <returns></returns>
public async Task Assert(Semantic semantic, string input)
{
await semantic.HasConditionAsync(input, Condition);
var result = await semantic.HasConditionAsync(input, Condition);

if (!result.IsValid)
throw new SemanticAssertException(result.Reason ?? "No reason is provided.");
}

public string AssertionType => "Condition";
Expand Down

0 comments on commit 8167065

Please sign in to comment.