當前位置: 首頁>>代碼示例>>C#>>正文


C# Constraints.Constraint類代碼示例

本文整理匯總了C#中NUnit.Framework.Constraints.Constraint的典型用法代碼示例。如果您正苦於以下問題:C# Constraint類的具體用法?C# Constraint怎麽用?C# Constraint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Constraint類屬於NUnit.Framework.Constraints命名空間,在下文中一共展示了Constraint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Matches

        /// <summary>
        /// Test whether the constraint is satisfied by a given value
        /// </summary>
        /// <param name="actual">The value to be tested</param>
        /// <returns>True for if the base constraint fails, false if it succeeds</returns>
        public override bool Matches(object actual)
        {
            this.actual = actual;
            if ( this.caseInsensitive )
                baseConstraint = baseConstraint.IgnoreCase;

            return !baseConstraint.Matches(actual);
        }
開發者ID:fotisp,項目名稱:conqat,代碼行數:13,代碼來源:NotConstraint.cs

示例2: AttributeConstraint

        /// <summary>
        /// Constructs an AttributeConstraint for a specified attriute
        /// Type and base constraint.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="baseConstraint"></param>
        public AttributeConstraint(Type type, Constraint baseConstraint)
            : base( baseConstraint )
        {
            this.expectedType = type;

            if (!typeof(Attribute).IsAssignableFrom(expectedType))
                throw new ArgumentException(string.Format(
                    "Type {0} is not an attribute", expectedType), "type");
        }
開發者ID:Phaiax,項目名稱:dotnetautoupdate,代碼行數:15,代碼來源:AttributeConstraints.cs

示例3: PassModifiersToBase

		/// <summary>
		/// Set all modifiers applied to the prefix into
		/// the base constraint before matching
		/// </summary>
		protected void PassModifiersToBase()
		{
			if ( this.caseInsensitive )
				baseConstraint = baseConstraint.IgnoreCase;
			if ( this.tolerance != null )
				baseConstraint = baseConstraint.Within( tolerance );
			if ( this.compareAsCollection )
				baseConstraint = baseConstraint.AsCollection;
			if ( this.compareWith != null )
				baseConstraint = baseConstraint.Comparer( compareWith );
		}
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:15,代碼來源:PrefixConstraints.cs

示例4: Matches

        /// <summary>
        /// Apply the item constraint to each item in the collection,
        /// failing if any item fails.
        /// </summary>
        /// <param name="actual"></param>
        /// <returns></returns>
        public override bool Matches(object actual)
        {
            this.actual = actual;
            if ( actual == null || !(actual is ICollection) )
                return false;

            if ( this.caseInsensitive )
                itemConstraint = itemConstraint.IgnoreCase;
            foreach(object item in (ICollection)actual)
                if (!itemConstraint.Matches(item))
                    return false;

            return true;
        }
開發者ID:fotisp,項目名稱:conqat,代碼行數:20,代碼來源:CollectionConstraints.cs

示例5: SetConstraint

 public virtual Constraint SetConstraint(Constraint constraint)
 {
     baseConstraint = constraint;
     return this;
 }
開發者ID:mbsky,項目名稱:dotnetmarcheproject,代碼行數:5,代碼來源:UnaryOperator.cs

示例6: ApplyOperator

 /// <summary>
 /// Abstract method that produces a constraint by applying
 /// the operator to its left and right constraint arguments.
 /// </summary>
 public abstract Constraint ApplyOperator(Constraint left, Constraint right);
開發者ID:imgen,項目名稱:Andr.Unit,代碼行數:5,代碼來源:ConstraintOperators.cs

示例7: NotConstraint

		/// <summary>
		/// Initializes a new instance of the <see cref="T:NotConstraint"/> class.
		/// </summary>
		/// <param name="baseConstraint">The base constraint to be negated.</param>
		public NotConstraint(Constraint baseConstraint)
			: base( baseConstraint ) { }
開發者ID:Phaiax,項目名稱:dotnetautoupdate,代碼行數:6,代碼來源:PrefixConstraints.cs

示例8: IsOrderedBy

 public void IsOrderedBy(IEnumerable collection, Constraint constraint)
 {
     Assert.That(collection, constraint);
 }
開發者ID:appel1,項目名稱:nunit,代碼行數:4,代碼來源:CollectionOrderedConstraintTests.cs

示例9: ThrowsConstraint

 /// <summary>
 /// Initializes a new instance of the <see cref="T:ThrowsConstraint"/> class,
 /// using a constraint to be applied to the exception.
 /// </summary>
 /// <param name="baseConstraint">A constraint to apply to the caught exception.</param>
 public ThrowsConstraint(Constraint baseConstraint)
     : base(baseConstraint) { }
開發者ID:imgen,項目名稱:Andr.Unit,代碼行數:7,代碼來源:ThrowsConstraint.cs

示例10: NoItemConstraint

		/// <summary>
		/// Construct a SomeItemsConstraint on top of an existing constraint
		/// </summary>
		/// <param name="itemConstraint"></param>
		public NoItemConstraint(Constraint itemConstraint)
			: base( itemConstraint ) 
        {
            this.DisplayName = "none";
        }
開發者ID:Phaiax,項目名稱:dotnetautoupdate,代碼行數:9,代碼來源:PrefixConstraints.cs

示例11: NoItemConstraint

		/// <summary>
		/// Construct a SomeItemsConstraint on top of an existing constraint
		/// </summary>
		/// <param name="itemConstraint"></param>
		public NoItemConstraint(Constraint itemConstraint)
			: base( itemConstraint ) { }
開發者ID:nobled,項目名稱:mono,代碼行數:6,代碼來源:PrefixConstraints.cs

示例12: PrefixConstraint

		/// <summary>
		/// Construct given a base constraint
		/// </summary>
		/// <param name="baseConstraint"></param>
		protected PrefixConstraint( Constraint baseConstraint )
		{
			this.baseConstraint = baseConstraint;
		}
開發者ID:nobled,項目名稱:mono,代碼行數:8,代碼來源:PrefixConstraints.cs

示例13: AllItemsConstraint

		/// <summary>
		/// Construct an AllItemsConstraint on top of an existing constraint
		/// </summary>
		/// <param name="itemConstraint"></param>
		public AllItemsConstraint(Constraint itemConstraint)
			: base( itemConstraint ) { }
開發者ID:nobled,項目名稱:mono,代碼行數:6,代碼來源:PrefixConstraints.cs

示例14: SomeItemsConstraint

		/// <summary>
		/// Construct a SomeItemsConstraint on top of an existing constraint
		/// </summary>
		/// <param name="itemConstraint"></param>
		public SomeItemsConstraint(Constraint itemConstraint)
			: base( itemConstraint ) { }
開發者ID:nobled,項目名稱:mono,代碼行數:6,代碼來源:PrefixConstraints.cs

示例15: ApplyPrefix

 /// <summary>
 /// Returns a constraint that will apply the argument
 /// to the members of a collection, succeeding if
 /// none of them succeed.
 /// </summary>
 public override Constraint ApplyPrefix(Constraint constraint)
 {
     return new ExactCountConstraint(expectedCount, constraint);
 }
開發者ID:pjcollins,項目名稱:Andr.Unit,代碼行數:9,代碼來源:ExactCountOperator.cs


注:本文中的NUnit.Framework.Constraints.Constraint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。