Esempio n. 1
0
            public void CheckIf_Channel_HaveRequiredTitleAndAddress()
            {
                int result = 0;
                var target = new Channel();
                var item1  = target.Title;
                var item2  = target.Address;

                SomeItemsConstraint condition1 = Contains.Item(item1);
                SomeItemsConstraint condition2 = Contains.Item(item2);

                if ((condition1 != null) && condition2 != null)
                {
                    result = 1;
                }
                Assert.That(result, Is.EqualTo(1));
            }
        /// <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;
        }
Esempio n. 3
0
        public void AnotherConstraintUsingThrows()
        {
            var constraint = new SomeItemsConstraint(new EmptyCollectionConstraint());

            Assert.Throws <ArgumentException>(() => constraint.Using((IComparer <string>)Comparer <string> .Default));
        }
Esempio n. 4
0
        public void EqualConstraintUsingDoesNotThrow()
        {
            var constraint = new SomeItemsConstraint(new EqualConstraint("42"));

            Assert.DoesNotThrow(() => constraint.Using((IComparer <string>)Comparer <string> .Default));
        }
Esempio n. 5
0
 public static SomeItemsConstraint UsingCodeFragmentComparer(this SomeItemsConstraint constraint) =>
 constraint.Using(Comparer);