Exemple #1
0
 public void SetUp()
 {
     Matcher = new NotConstraint( new EqualConstraint( null ) );
     GoodValues = new object[] {42, "Hello"};
     BadValues = new object[] {null};
     Description = "not null";
 }
        /// <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 ( _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( _opnds.Pop(), constraint );
                        break;
                }
            }

            return constraint;
        }