/// <summary> /// Resolve a constraint that has been recognized by applying /// any pending operators and returning the resulting Constraint. /// </summary> /// <returns>A constraint that incorporates all pending operators</returns> private Constraint Resolve(Constraint constraint) { while (ops.Count > 0) { switch ((Op)ops.Pop()) { case Op.Not: constraint = new NotConstraint(constraint); break; case Op.All: constraint = new AllItemsConstraint(constraint); break; case Op.Some: constraint = new SomeItemsConstraint(constraint); break; case Op.None: constraint = new NoItemConstraint(constraint); break; #if NOT_PFX case Op.Prop: constraint = new PropertyConstraint((string)opnds.Pop(), constraint); break; #endif } } return(constraint); }
/// <summary> /// Resolve a constraint that has been recognized by applying /// any pending operators and returning the resulting Constraint. /// </summary> /// <param name="constraint">The root constraint</param> /// <returns>A constraint that incorporates all pending operators</returns> private Constraint Resolve(Constraint constraint) { while (ops.Count > 0) { switch ((Op)ops.Pop()) { case Op.Not: constraint = new NotConstraint(constraint); break; case Op.All: constraint = new AllItemsConstraint(constraint); break; case Op.Some: constraint = new SomeItemsConstraint(constraint); break; } } return(constraint); }
/// <summary> /// Resolve a constraint that has been recognized by applying /// any pending operators and returning the resulting Constraint. /// </summary> /// <returns>A constraint that incorporates all pending operators</returns> private Constraint Resolve(Constraint constraint) { while (ops.Count > 0) switch ((Op)ops.Pop()) { case Op.Not: constraint = new NotConstraint(constraint); break; case Op.All: constraint = new AllItemsConstraint(constraint); break; case Op.Some: constraint = new SomeItemsConstraint(constraint); break; case Op.None: constraint = new NoItemConstraint(constraint); break; case Op.Prop: constraint = new PropertyConstraint( (string)opnds.Pop(), constraint ); break; } return constraint; }
public void AnotherConstraintUsingThrows() { var constraint = new SomeItemsConstraint(new EmptyCollectionConstraint()); Assert.Throws <ArgumentException>(() => constraint.Using((IComparer <string>)Comparer <string> .Default)); }
public void EqualConstraintUsingDoesNotThrow() { var constraint = new SomeItemsConstraint(new EqualConstraint("42")); Assert.DoesNotThrow(() => constraint.Using((IComparer <string>)Comparer <string> .Default)); }
/// <summary> /// Resolve a constraint that has been recognized by applying /// any pending operators and returning the resulting Constraint. /// </summary> /// <param name="constraint">The root constraint</param> /// <returns>A constraint that incorporates all pending operators</returns> private Constraint Resolve(Constraint constraint) { while (ops.Count > 0) switch ((Op)ops.Pop()) { case Op.Not: constraint = new NotConstraint(constraint); break; case Op.All: constraint = new AllItemsConstraint(constraint); break; case Op.Some: constraint = new SomeItemsConstraint(constraint); break; } return constraint; }