<PackageReference Include="NUnit" Version="2.6.1" />

ConstraintFactory

public class ConstraintFactory
Helper class with properties and methods that supply a number of constraints used in Asserts.
public ConstraintExpression All { get; }

Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them succeed.

Returns a constraint that tests whether an object graph is serializable in binary format.

Returns a new ConstraintExpression, which will apply the following constraint to the Count property of the object being tested.

public EmptyConstraint Empty { get; }

Returns a constraint that tests for empty

public FalseConstraint False { get; }

Returns a constraint that tests for False

Returns a new ConstraintExpression, which will apply the following constraint to the InnerException property of the object being tested.

Returns a new ConstraintExpression, which will apply the following constraint to the Length property of the object being tested.

Returns a new ConstraintExpression, which will apply the following constraint to the Message property of the object being tested.

public NaNConstraint NaN { get; }

Returns a constraint that tests for NaN

public LessThanConstraint Negative { get; }

Returns a constraint that tests for a negative value

public ConstraintExpression No { get; }

Returns a ConstraintExpression that negates any following constraint.

public ConstraintExpression None { get; }

Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if all of them fail.

public ConstraintExpression Not { get; }

Returns a ConstraintExpression that negates any following constraint.

public NullConstraint Null { get; }

Returns a constraint that tests for null

Returns a constraint that tests whether a collection is ordered

Returns a constraint that tests for a positive value

public ConstraintExpression Some { get; }

Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding if at least one of them succeeds.

public TrueConstraint True { get; }

Returns a constraint that tests for True

public UniqueItemsConstraint Unique { get; }

Returns a constraint that tests whether a collection contains all unique items.

Returns a constraint that tests whether an object graph is serializable in xml format.

public static ConstraintExpression Exactly(int expectedCount)

Returns a ConstraintExpression, which will apply the following constraint to all members of a collection, succeeding only if a specified number of them succeed.

Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument.

Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument.

Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument.

Returns a constraint that tests whether the actual value is assignable from the type supplied as an argument.

public GreaterThanOrEqualConstraint AtLeast(object expected)

Returns a constraint that tests whether the actual value is greater than or equal to the suppled argument

public LessThanOrEqualConstraint AtMost(object expected)

Returns a constraint that tests whether the actual value is less than or equal to the suppled argument

Returns a new AttributeConstraint checking for the presence of a particular attribute on an object.

Returns a new AttributeConstraint checking for the presence of a particular attribute on an object.

public CollectionContainsConstraint Contains(object expected)

Returns a new CollectionContainsConstraint checking for the presence of a particular object in the collection.

public ContainsConstraint Contains(string expected)

Returns a new ContainsConstraint. This constraint will, in turn, make use of the appropriate second-level constraint, depending on the type of the actual argument. This overload is only used if the item sought is a string, since any other type implies that we are looking for a collection member.

public SubstringConstraint ContainsSubstring(string expected)

Returns a constraint that succeeds if the actual value contains the substring supplied as an argument.

public SubstringConstraint DoesNotContain(string expected)

Returns a constraint that fails if the actual value contains the substring supplied as an argument.

public EndsWithConstraint DoesNotEndWith(string expected)

Returns a constraint that fails if the actual value ends with the substring supplied as an argument.

public RegexConstraint DoesNotMatch(string pattern)

Returns a constraint that fails if the actual value matches the pattern supplied as an argument.

public StartsWithConstraint DoesNotStartWith(string expected)

Returns a constraint that fails if the actual value starts with the substring supplied as an argument.

public EndsWithConstraint EndsWith(string expected)

Returns a constraint that succeeds if the actual value ends with the substring supplied as an argument.

public EqualConstraint EqualTo(object expected)

Returns a constraint that tests two items for equality

Returns a constraint that tests whether the actual value is a collection containing the same elements as the collection supplied as an argument.

public GreaterThanConstraint GreaterThan(object expected)

Returns a constraint that tests whether the actual value is greater than the suppled argument

Returns a constraint that tests whether the actual value is greater than or equal to the suppled argument

public RangeConstraint<T> InRange<T>(T from, T to) where T : IComparable<T>

Returns a constraint that tests whether the actual value falls within a specified range.

Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type.

Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type.

Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type.

Returns a constraint that tests whether the actual value is of the type supplied as an argument or a derived type.

public LessThanConstraint LessThan(object expected)

Returns a constraint that tests whether the actual value is less than the suppled argument

Returns a constraint that tests whether the actual value is less than or equal to the suppled argument

public RegexConstraint Matches(string pattern)

Returns a constraint that succeeds if the actual value matches the Regex pattern supplied as an argument.

public CollectionContainsConstraint Member(object expected)

Returns a new CollectionContainsConstraint checking for the presence of a particular object in the collection.

Returns a new PropertyConstraintExpression, which will either test for the existence of the named property on the object being tested or apply any following constraint to that property.

public SameAsConstraint SameAs(object expected)

Returns a constraint that tests that two references are the same object

public SamePathConstraint SamePath(string expected)

Returns a constraint that tests whether the path provided is the same as an expected path after canonicalization.

Returns a constraint that tests whether the path provided is the same path or under an expected path after canonicalization.

public StartsWithConstraint StartsWith(string expected)

Returns a constraint that succeeds if the actual value starts with the substring supplied as an argument.

public SubstringConstraint StringContaining(string expected)

Returns a constraint that succeeds if the actual value contains the substring supplied as an argument.

public EndsWithConstraint StringEnding(string expected)

Returns a constraint that succeeds if the actual value ends with the substring supplied as an argument.

public RegexConstraint StringMatching(string pattern)

Returns a constraint that succeeds if the actual value matches the Regex pattern supplied as an argument.

public StartsWithConstraint StringStarting(string expected)

Returns a constraint that succeeds if the actual value starts with the substring supplied as an argument.

public SubPathConstraint SubPath(string expected)

Returns a constraint that tests whether the path provided is the same path or under an expected path after canonicalization.

Returns a constraint that tests whether the actual value is a subset of the collection supplied as an argument.

public ExactTypeConstraint TypeOf(Type expectedType)

Returns a constraint that tests whether the actual value is of the exact type supplied as an argument.

Returns a constraint that tests whether the actual value is of the exact type supplied as an argument.