public void Fail() { var expression = Expression(m => m.Text == "test" ? DryvResultMessage.Error("fail") : null); var jsProgram = GetTranslatedAst(expression); var conditional = GetBodyExpression <ConditionalExpression>(jsProgram); var properties = (conditional.Consequent as ObjectExpression)?.Properties; Assert.IsNotNull(properties); var first = (dynamic)properties.First().Value; Assert.AreEqual("error", first.Value); var second = (dynamic)properties.Last().Value; Assert.AreEqual("fail", second.Value); }
public static DryvRules Rules() => DryvRules .For <Model5>() .Rule(m => m.Text, m => m.Text != null ? DryvResultMessage.Success : DryvResultMessage.Error("error"));