public void Verify_complex_expression_evaluation()
 {
     var evaluator = new Evaluator();
     Assert.IsTrue(evaluator.Compute("(true || ((true || (false || true)))) || (true && true && false || (false || true && (true && true || ((false))))) && false"));
     Assert.IsTrue(evaluator.Compute("( !!((!(!!!true || !!false || !true))) && true && !(true && false) ) && (!((!(!true))) || !!!(((!true))))"));
 }
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            if (DependentProperties.Length != TargetValues.Length)
                throw new ArgumentException("Number of elements in DependentProperties and TargetValues must match.");

            var tokens = new List<object>();
            for (var i = 0; i < DependentProperties.Count(); i++)
            {
                var dependentValue = Helper.ExtractValue(validationContext.ObjectInstance, DependentProperties[i]);
                var targetValue = Helper.FetchTargetValue(TargetValues[i], validationContext);
                var result = Helper.Compare(dependentValue, targetValue);
                tokens.Add(result.ToString().ToLowerInvariant());
            }

            var expression = string.Format(Expression, tokens.ToArray());
            var evaluator = new Evaluator();
            if (evaluator.Compute(expression))
            {
                // match => means we should try to validate this field
                if (!_innerAttribute.IsValid(value) || (value is bool && !(bool) value))
                {
                    // validation failed - return an error
                    return new ValidationResult(string.Format(ErrorMessageString, validationContext.DisplayName));
                }
            }

            return ValidationResult.Success;
        }