OR Condition

Feb 4, 2015 at 11:15 AM
Is there a way where we can write OR conditions
Coordinator
Feb 4, 2015 at 9:19 PM
Hi,

I am assuming you are talking about the If clause. There is no 'Or' clause as such - it is not needed you can put your Or within the Lambda expression. E.g.
        static void Main(string[] args)
        {
            Engine engine = new Engine();
            engine.For<PhoneNumber>()
                .Setup(ph => ph.Number)
                    .MustBeGreaterThan(0)
                .If(ph => ph.CountryCode == 61 || ph.CountryCode == 71)
                    .Setup(ph => ph.AreaCode)
                        .MustBeOneOf(2, 3, 4, 7, 8)
                .Else()
                    .Setup(ph => ph.AreaCode)
                        .MustEqual(0)
                .EndIf();