public double Evaluate(double value, int precision) { double r = value * 5; r = number.Evaluate(r, precision + 1); return(r / 5); }
public bool Matches(AutomationElement element, int index) { if (_op == XPathOperator.Union) { throw new System.NotImplementedException(); } IEvaluate canGetValue = _left as IEvaluate; var left = canGetValue.Evaluate(element); switch (_op) { case XPathOperator.Eq: return(_right.Equals(left)); case XPathOperator.Ge: case XPathOperator.Gt: case XPathOperator.Le: case XPathOperator.Lt: case XPathOperator.Ne: break; default: throw new System.Exception("Not a relational operator " + _op); } throw new System.NotImplementedException(); }
public ValidationResult IsValid(XPath xpath, string value, IEvaluate evaluate) { var failures = new List <ValidationFailure>(); var expected = evaluate.Evaluate <string>(Expected); if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(expected) && value != expected) { failures.Add(new ValidationFailure(nameof(Required), $"Node [{xpath.Expression}] is different from [{Expected.Expression}]. Actual: [{value}], Expected: [{expected}]")); } return(new ValidationResult(failures)); }
/// <summary> /// Lazy indexer. /// </summary> public new T this[int index] { get { var underlyingItem = this.collection[index]; IEvaluate itemLazy = underlyingItem as IEvaluate; if (itemLazy != null && (!itemLazy.IsEvaluated)) { itemLazy.Evaluate(); } // return evaluated items return(underlyingItem); } set { throw new NotImplementedException(); } }
/// <summary> /// Lazy indexer. /// </summary> public new T this[int index] { get { var underlyingItem = this.lazifiedCollection[index]; IEvaluate itemLazy = underlyingItem as IEvaluate; if (itemLazy != null) { if (!itemLazy.IsEvaluated) { itemLazy.Evaluate(); } } // return item, evaluated if it was IEvaluate return(underlyingItem); } set { throw new NotImplementedException(); } }