コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: ConstraintBuilder.cs プロジェクト: ngraziano/mono
        /// <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;
        }
コード例 #4
0
        public void AnotherConstraintUsingThrows()
        {
            var constraint = new SomeItemsConstraint(new EmptyCollectionConstraint());

            Assert.Throws <ArgumentException>(() => constraint.Using((IComparer <string>)Comparer <string> .Default));
        }
コード例 #5
0
        public void EqualConstraintUsingDoesNotThrow()
        {
            var constraint = new SomeItemsConstraint(new EqualConstraint("42"));

            Assert.DoesNotThrow(() => constraint.Using((IComparer <string>)Comparer <string> .Default));
        }
コード例 #6
0
ファイル: ConstraintBuilder.cs プロジェクト: fotisp/conqat
        /// <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;
        }