示例#1
0
        /// <summary>
        /// Build a collection of constraint (in fact one by expected item)
        /// Pay really attention that CollectionContainsConstraint is expecting one unique item!
        /// So if you cant to check for several items, you need to apply several Constraint (one by expected item)
        /// </summary>
        protected virtual void BuildInternalConstraint()
        {
            NUnitCtr.Constraint ctr = null;
            foreach (var item in Expected)
            {
                var localCtr = new NUnitCtr.CollectionContainsConstraint(StringComparerHelper.Build(item));
                var usingCtr = localCtr.Using(Comparer);

                if (ctr != null)
                {
                    ctr = new AndConstraint(ctr, usingCtr);
                }
                else
                {
                    ctr = usingCtr;
                }
            }

            if (ctr == null)
            {
                ctr = new NUnitCtr.EmptyCollectionConstraint();
            }

            IResolveConstraint exp = ctr;

            InternalConstraint = exp.Resolve();
        }
示例#2
0
        /// <summary>
        /// Build a collection of constraint (in fact one by expected item)
        /// Pay really attention that CollectionContainsConstraint is expecting one unique item!
        /// So if you cant to check for several items, you need to apply several Constraint (one by expected item)
        /// </summary>
        protected virtual void BuildInternalConstraint()
        {
            NUnitCtr.Constraint ctr = null;
            foreach (var item in Expected)
            {
                var localCtr = new NUnitCtr.CollectionContainsConstraint(StringComparerHelper.Build(item));
                var usingCtr = localCtr.Using(Comparer);

                if (ctr != null)
                    ctr = new AndConstraint(ctr, usingCtr);
                else
                    ctr = usingCtr;
            }

            if (ctr == null)
                ctr = new NUnitCtr.EmptyCollectionConstraint();

            IResolveConstraint exp = ctr;
            InternalConstraint = exp.Resolve();
        }