public NotConstraint(BaseConstraint baseConstraint) { if (baseConstraint == null) { throw new ArgumentNullException("baseConstraint"); } _baseConstraint = baseConstraint; }
/// <summary> /// Adds the specified constraint to the And BaseConstraint chain of a multiple <see cref="BaseConstraint"/> /// element search. When calling And or using the operators, WatiN will always use /// ConditionAnd (&&) during the evaluation. /// <seealso cref="Or"/> /// </summary> /// <param name="baseConstraint">The <see cref="BaseConstraint"/> instance.</param> /// <returns>This <see cref="BaseConstraint"/></returns> /// <example> /// If you want to find a Button by it's name and value this example shows you how to use /// the And method to do this: /// <code> /// IE ie = new IE("www.yourwebsite.com/yourpage.htm"); /// /// Button myButton = ie.Button(Find.ByName("buttonname").And(Find.ByValue("Button value"))); /// </code> /// /// You can also use the & or && operators, resulting in a bit more readable code. /// <code> /// IE ie = new IE("www.yourwebsite.com/yourpage.htm"); /// /// Button myButton = ie.Button(Find.ByName("buttonname") & Find.ByValue("Button value")); /// </code> /// </example> public BaseConstraint And(BaseConstraint baseConstraint) { if (_andBaseConstraint == null) { _andBaseConstraint = baseConstraint; } else { _lastAddedBaseConstraint.And(baseConstraint); } _lastAddedBaseConstraint = baseConstraint; return this; }
/// <summary> /// Adds the specified constaint to the Or constraint chain of a multiple <see cref="BaseConstraint"/> /// element search. When calling Or or using the | or || operators, WatiN will always use /// ConditionOr (||) during the evaluation. /// <seealso cref="And"/> /// </summary> /// <param name="baseConstraint">The <see cref="BaseConstraint"/> instance.</param> /// <returns>This <see cref="BaseConstraint"/></returns> /// <example> /// If you want to find a Button by it's English or Dutch value this example shows you how to use /// the Or method to do this: /// <code> /// IE ie = new IE("www.yourwebsite.com/yourpage.htm"); /// /// Button myButton = ie.Button(Find.ByValue("Cancel").Or(Find.ByValue("Annuleren"))); /// </code> /// /// You can also use the | or || operators, resulting in a bit more readable code. /// <code> /// IE ie = new IE("www.yourwebsite.com/yourpage.htm"); /// /// Button myButton = ie.Button(Find.ByValue("Cancel") || Find.ByValue("Annuleren")); /// </code> /// </example> public BaseConstraint Or(BaseConstraint baseConstraint) { if (_orBaseConstraint == null) { _orBaseConstraint = baseConstraint; } else { _lastAddedOrBaseConstraint.Or(baseConstraint); } _lastAddedOrBaseConstraint = baseConstraint; _lastAddedBaseConstraint = baseConstraint; return this; }