当前位置: 首页>>代码示例>>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;未经允许,请勿转载。