Search Results for

    Show / Hide Table of Contents

    Class ConstraintExpression

    ConstraintExpression represents a compound constraint in the process of being constructed from a series of syntactic elements.

    Individual elements are appended to the expression as they are reorganized. When a constraint is appended, it is returned as the value of the operation so that modifiers may be applied. However, any partially built expression is attached to the constraint for later resolution. When an operator is appended, the partial expression is returned. If it's a self-resolving operator, then a ResolvableConstraintExpression is returned.

    Inheritance
    object
    ConstraintExpression
    ItemsConstraintExpression
    ResolvableConstraintExpression
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Constraints
    Assembly: nunit.framework.dll
    Syntax
    public class ConstraintExpression

    Constructors

    View Source

    ConstraintExpression()

    Initializes a new instance of the ConstraintExpression class.

    Declaration
    public ConstraintExpression()
    View Source

    ConstraintExpression(ConstraintBuilder)

    Initializes a new instance of the ConstraintExpression class passing in a ConstraintBuilder, which may be pre-populated.

    Declaration
    public ConstraintExpression(ConstraintBuilder builder)
    Parameters
    Type Name Description
    ConstraintBuilder builder

    The builder.

    Fields

    View Source

    builder

    The ConstraintBuilder holding the elements recognized so far

    Declaration
    protected readonly ConstraintBuilder builder
    Field Value
    Type Description
    ConstraintBuilder

    Properties

    View Source

    All

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

    Declaration
    public ConstraintExpression All { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    Count

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

    Declaration
    public ResolvableConstraintExpression Count { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    Default

    Returns a constraint that tests for default value

    Declaration
    public DefaultConstraint Default { get; }
    Property Value
    Type Description
    DefaultConstraint
    View Source

    Empty

    Returns a constraint that tests for empty

    Declaration
    public EmptyConstraint Empty { get; }
    Property Value
    Type Description
    EmptyConstraint
    View Source

    Exist

    Returns a constraint that succeeds if the value is a file or directory and it exists.

    Declaration
    public Constraint Exist { get; }
    Property Value
    Type Description
    Constraint
    View Source

    False

    Returns a constraint that tests for False

    Declaration
    public FalseConstraint False { get; }
    Property Value
    Type Description
    FalseConstraint
    View Source

    InnerException

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

    Declaration
    public ResolvableConstraintExpression InnerException { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    Length

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

    Declaration
    public ResolvableConstraintExpression Length { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    Message

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

    Declaration
    public ResolvableConstraintExpression Message { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    NaN

    Returns a constraint that tests for NaN

    Declaration
    public NaNConstraint NaN { get; }
    Property Value
    Type Description
    NaNConstraint
    View Source

    Negative

    Returns a constraint that tests for a negative value

    Declaration
    public LessThanConstraint Negative { get; }
    Property Value
    Type Description
    LessThanConstraint
    View Source

    No

    Returns a ConstraintExpression that negates any following constraint.

    Declaration
    public ConstraintExpression No { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    None

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

    Declaration
    public ConstraintExpression None { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    Not

    Returns a ConstraintExpression that negates any following constraint.

    Declaration
    public ConstraintExpression Not { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    Null

    Returns a constraint that tests for null

    Declaration
    public NullConstraint Null { get; }
    Property Value
    Type Description
    NullConstraint
    View Source

    One

    Returns a ItemsConstraintExpression, which will apply the following constraint to a collection of length one, succeeding only if exactly one of them succeeds.

    Declaration
    public ItemsConstraintExpression One { get; }
    Property Value
    Type Description
    ItemsConstraintExpression
    View Source

    Ordered

    Returns a constraint that tests whether a collection is ordered

    Declaration
    public CollectionOrderedConstraint Ordered { get; }
    Property Value
    Type Description
    CollectionOrderedConstraint
    View Source

    Positive

    Returns a constraint that tests for a positive value

    Declaration
    public GreaterThanConstraint Positive { get; }
    Property Value
    Type Description
    GreaterThanConstraint
    View Source

    Some

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

    Declaration
    public ConstraintExpression Some { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    True

    Returns a constraint that tests for True

    Declaration
    public TrueConstraint True { get; }
    Property Value
    Type Description
    TrueConstraint
    View Source

    Unique

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

    Declaration
    public UniqueItemsConstraint Unique { get; }
    Property Value
    Type Description
    UniqueItemsConstraint
    View Source

    WhiteSpace

    Returns a constraint that tests for white-space

    Declaration
    public WhiteSpaceConstraint WhiteSpace { get; }
    Property Value
    Type Description
    WhiteSpaceConstraint
    View Source

    With

    With is currently a NOP - reserved for future use.

    Declaration
    public ConstraintExpression With { get; }
    Property Value
    Type Description
    ConstraintExpression
    View Source

    XmlSerializable

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

    Declaration
    public XmlSerializableConstraint XmlSerializable { get; }
    Property Value
    Type Description
    XmlSerializableConstraint
    View Source

    Zero

    Returns a constraint that tests if item is equal to zero

    Declaration
    public EqualConstraint Zero { get; }
    Property Value
    Type Description
    EqualConstraint

    Methods

    View Source

    AnyOf(ICollection)

    Returns a constraint that tests if an item is equal to any of expected values

    Declaration
    public AnyOfConstraint AnyOf(ICollection expected)
    Parameters
    Type Name Description
    ICollection expected

    Expected values

    Returns
    Type Description
    AnyOfConstraint
    View Source

    AnyOf(params object?[]?)

    Returns a constraint that tests if an item is equal to any of parameters

    Declaration
    public AnyOfConstraint AnyOf(params object?[]? expected)
    Parameters
    Type Name Description
    object[] expected

    Expected values

    Returns
    Type Description
    AnyOfConstraint
    View Source

    Append(Constraint)

    Appends a constraint to the expression and returns that constraint, which is associated with the current state of the expression being built. Note that the constraint is not reduced at this time. For example, if there is a NotOperator on the stack we don't reduce and return a NotConstraint. The original constraint must be returned because it may support modifiers that are yet to be applied.

    Declaration
    public Constraint Append(Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint
    Returns
    Type Description
    Constraint
    View Source

    Append(ConstraintOperator)

    Appends an operator to the expression and returns the resulting expression itself.

    Declaration
    public ConstraintExpression Append(ConstraintOperator op)
    Parameters
    Type Name Description
    ConstraintOperator op
    Returns
    Type Description
    ConstraintExpression
    View Source

    Append(SelfResolvingOperator)

    Appends a self-resolving operator to the expression and returns a new ResolvableConstraintExpression.

    Declaration
    public ResolvableConstraintExpression Append(SelfResolvingOperator op)
    Parameters
    Type Name Description
    SelfResolvingOperator op
    Returns
    Type Description
    ResolvableConstraintExpression
    View Source

    Append<T>(T)

    Appends a constraint to the expression and returns that constraint, which is associated with the current state of the expression being built. Note that the constraint is not reduced at this time. For example, if there is a NotOperator on the stack we don't reduce and return a NotConstraint. The original constraint must be returned because it may support modifiers that are yet to be applied.

    Declaration
    public T Append<T>(T constraint) where T : Constraint
    Parameters
    Type Name Description
    T constraint
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    AssignableFrom(Type)

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

    Declaration
    public AssignableFromConstraint AssignableFrom(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    AssignableFromConstraint
    View Source

    AssignableFrom<TExpected>()

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

    Declaration
    public AssignableFromConstraint AssignableFrom<TExpected>()
    Returns
    Type Description
    AssignableFromConstraint
    Type Parameters
    Name Description
    TExpected
    View Source

    AssignableTo(Type)

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

    Declaration
    public AssignableToConstraint AssignableTo(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    AssignableToConstraint
    View Source

    AssignableTo<TExpected>()

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

    Declaration
    public AssignableToConstraint AssignableTo<TExpected>()
    Returns
    Type Description
    AssignableToConstraint
    Type Parameters
    Name Description
    TExpected
    View Source

    AtLeast(object)

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

    Declaration
    public GreaterThanOrEqualConstraint AtLeast(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    GreaterThanOrEqualConstraint
    View Source

    AtMost(object)

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

    Declaration
    public LessThanOrEqualConstraint AtMost(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    LessThanOrEqualConstraint
    View Source

    Attribute(Type)

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

    Declaration
    public ResolvableConstraintExpression Attribute(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    ResolvableConstraintExpression
    View Source

    Attribute<TExpected>()

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

    Declaration
    public ResolvableConstraintExpression Attribute<TExpected>()
    Returns
    Type Description
    ResolvableConstraintExpression
    Type Parameters
    Name Description
    TExpected
    View Source

    Contain(object?)

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

    Declaration
    public SomeItemsConstraint Contain(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    SomeItemsConstraint
    View Source

    Contain(string?)

    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.

    Declaration
    public ContainsConstraint Contain(string? expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    ContainsConstraint
    View Source

    ContainKey(object)

    Returns a new DictionaryContainsKeyConstraint checking for the presence of a particular key in the Dictionary key collection.

    Declaration
    public DictionaryContainsKeyConstraint ContainKey(object expected)
    Parameters
    Type Name Description
    object expected

    The key to be matched in the Dictionary key collection

    Returns
    Type Description
    DictionaryContainsKeyConstraint
    View Source

    ContainValue(object?)

    Returns a new DictionaryContainsValueConstraint checking for the presence of a particular value in the Dictionary value collection.

    Declaration
    public DictionaryContainsValueConstraint ContainValue(object? expected)
    Parameters
    Type Name Description
    object expected

    The value to be matched in the Dictionary value collection

    Returns
    Type Description
    DictionaryContainsValueConstraint
    View Source

    Contains(object?)

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

    To search for a substring instead of a collection element, use the Contains(string?) overload.

    Declaration
    public SomeItemsConstraint Contains(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    SomeItemsConstraint
    View Source

    Contains(string?)

    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.

    To search for a collection element instead of a substring, use the Contains(object?) overload.

    Declaration
    public ContainsConstraint Contains(string? expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    ContainsConstraint
    View Source

    EndWith(string)

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

    Declaration
    public EndsWithConstraint EndWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    EndsWithConstraint
    View Source

    EndsWith(string)

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

    Declaration
    public EndsWithConstraint EndsWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    EndsWithConstraint
    View Source

    EqualTo(byte)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<byte> EqualTo(byte expected)
    Parameters
    Type Name Description
    byte expected
    Returns
    Type Description
    EqualNumericConstraint<byte>
    View Source

    EqualTo(DateTime)

    Returns a constraint that tests two date time instances for equality

    Declaration
    public EqualTimeBaseConstraint<DateTime> EqualTo(DateTime expected)
    Parameters
    Type Name Description
    DateTime expected
    Returns
    Type Description
    EqualTimeBaseConstraint<DateTime>
    View Source

    EqualTo(DateTimeOffset)

    Returns a constraint that tests two date time offset instances for equality

    Declaration
    public EqualDateTimeOffsetConstraint EqualTo(DateTimeOffset expected)
    Parameters
    Type Name Description
    DateTimeOffset expected
    Returns
    Type Description
    EqualDateTimeOffsetConstraint
    View Source

    EqualTo(decimal)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<decimal> EqualTo(decimal expected)
    Parameters
    Type Name Description
    decimal expected
    Returns
    Type Description
    EqualNumericConstraint<decimal>
    View Source

    EqualTo(double)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<double> EqualTo(double expected)
    Parameters
    Type Name Description
    double expected
    Returns
    Type Description
    EqualNumericConstraint<double>
    View Source

    EqualTo(short)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<short> EqualTo(short expected)
    Parameters
    Type Name Description
    short expected
    Returns
    Type Description
    EqualNumericConstraint<short>
    View Source

    EqualTo(int)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<int> EqualTo(int expected)
    Parameters
    Type Name Description
    int expected
    Returns
    Type Description
    EqualNumericConstraint<int>
    View Source

    EqualTo(long)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<long> EqualTo(long expected)
    Parameters
    Type Name Description
    long expected
    Returns
    Type Description
    EqualNumericConstraint<long>
    View Source

    EqualTo(object?)

    Returns a constraint that tests two items for equality

    Declaration
    public EqualConstraint EqualTo(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    EqualConstraint
    View Source

    EqualTo(sbyte)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<sbyte> EqualTo(sbyte expected)
    Parameters
    Type Name Description
    sbyte expected
    Returns
    Type Description
    EqualNumericConstraint<sbyte>
    View Source

    EqualTo(float)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<float> EqualTo(float expected)
    Parameters
    Type Name Description
    float expected
    Returns
    Type Description
    EqualNumericConstraint<float>
    View Source

    EqualTo(string?)

    Returns a constraint that tests two strings for equality

    Declaration
    public EqualStringConstraint EqualTo(string? expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    EqualStringConstraint
    View Source

    EqualTo(TimeSpan)

    Returns a constraint that tests two timespan instances for equality

    Declaration
    public EqualTimeBaseConstraint<TimeSpan> EqualTo(TimeSpan expected)
    Parameters
    Type Name Description
    TimeSpan expected
    Returns
    Type Description
    EqualTimeBaseConstraint<TimeSpan>
    View Source

    EqualTo(ushort)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<ushort> EqualTo(ushort expected)
    Parameters
    Type Name Description
    ushort expected
    Returns
    Type Description
    EqualNumericConstraint<ushort>
    View Source

    EqualTo(uint)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<uint> EqualTo(uint expected)
    Parameters
    Type Name Description
    uint expected
    Returns
    Type Description
    EqualNumericConstraint<uint>
    View Source

    EqualTo(ulong)

    Returns a constraint that tests two numbers for equality

    Declaration
    public EqualNumericConstraint<ulong> EqualTo(ulong expected)
    Parameters
    Type Name Description
    ulong expected
    Returns
    Type Description
    EqualNumericConstraint<ulong>
    View Source

    EqualTo<T>(T?)

    Returns a constraint that tests two items for equality

    Declaration
    public EqualConstraint EqualTo<T>(T? expected)
    Parameters
    Type Name Description
    T expected
    Returns
    Type Description
    EqualConstraint
    Type Parameters
    Name Description
    T
    View Source

    EquivalentTo(IEnumerable)

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

    Declaration
    public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
    Parameters
    Type Name Description
    IEnumerable expected
    Returns
    Type Description
    CollectionEquivalentConstraint
    View Source

    Exactly(int)

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

    Declaration
    public ItemsConstraintExpression Exactly(int expectedCount)
    Parameters
    Type Name Description
    int expectedCount
    Returns
    Type Description
    ItemsConstraintExpression
    View Source

    GreaterThan(object)

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

    Declaration
    public GreaterThanConstraint GreaterThan(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    GreaterThanConstraint
    View Source

    GreaterThanOrEqualTo(object)

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

    Declaration
    public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    GreaterThanOrEqualConstraint
    View Source

    InRange(object, object)

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

    Declaration
    public RangeConstraint InRange(object from, object to)
    Parameters
    Type Name Description
    object from

    Inclusive beginning of the range.

    object to

    Inclusive end of the range.

    Returns
    Type Description
    RangeConstraint
    View Source

    InstanceOf(Type)

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

    Declaration
    public InstanceOfTypeConstraint InstanceOf(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    InstanceOfTypeConstraint
    View Source

    InstanceOf<TExpected>()

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

    Declaration
    public InstanceOfTypeConstraint InstanceOf<TExpected>()
    Returns
    Type Description
    InstanceOfTypeConstraint
    Type Parameters
    Name Description
    TExpected
    View Source

    ItemAt(params object[])

    Returns a new IndexerConstraintExpression, which will apply any following constraint to that indexer value.

    Declaration
    public ConstraintExpression ItemAt(params object[] indexArgs)
    Parameters
    Type Name Description
    object[] indexArgs

    Index accessor values.

    Returns
    Type Description
    ConstraintExpression
    View Source

    LessThan(object)

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

    Declaration
    public LessThanConstraint LessThan(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    LessThanConstraint
    View Source

    LessThanOrEqualTo(object)

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

    Declaration
    public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    LessThanOrEqualConstraint
    View Source

    Match(string)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public RegexConstraint Match(string pattern)
    Parameters
    Type Name Description
    string pattern
    Returns
    Type Description
    RegexConstraint
    View Source

    Match(Regex)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public RegexConstraint Match(Regex regex)
    Parameters
    Type Name Description
    Regex regex
    Returns
    Type Description
    RegexConstraint
    View Source

    Matches(IResolveConstraint)

    Returns the constraint provided as an argument - used to allow custom custom constraints to easily participate in the syntax.

    Declaration
    public Constraint Matches(IResolveConstraint constraint)
    Parameters
    Type Name Description
    IResolveConstraint constraint
    Returns
    Type Description
    Constraint
    View Source

    Matches(string)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public RegexConstraint Matches(string pattern)
    Parameters
    Type Name Description
    string pattern
    Returns
    Type Description
    RegexConstraint
    View Source

    Matches(Regex)

    Returns a constraint that succeeds if the actual value matches the regular expression supplied as an argument.

    Declaration
    public RegexConstraint Matches(Regex regex)
    Parameters
    Type Name Description
    Regex regex
    Returns
    Type Description
    RegexConstraint
    View Source

    Matches<TActual>(Predicate<TActual>)

    Returns the constraint provided as an argument - used to allow custom custom constraints to easily participate in the syntax.

    Declaration
    public Constraint Matches<TActual>(Predicate<TActual> predicate)
    Parameters
    Type Name Description
    Predicate<TActual> predicate
    Returns
    Type Description
    Constraint
    Type Parameters
    Name Description
    TActual
    View Source

    Member(object?)

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

    Declaration
    public SomeItemsConstraint Member(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    SomeItemsConstraint
    View Source

    Property(string)

    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.

    Declaration
    public ResolvableConstraintExpression Property(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    ResolvableConstraintExpression
    View Source

    SameAs(object?)

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

    Declaration
    public SameAsConstraint SameAs(object? expected)
    Parameters
    Type Name Description
    object expected
    Returns
    Type Description
    SameAsConstraint
    View Source

    SamePath(string)

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

    Declaration
    public SamePathConstraint SamePath(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    SamePathConstraint
    View Source

    SamePathOrUnder(string)

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

    Declaration
    public SamePathOrUnderConstraint SamePathOrUnder(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    SamePathOrUnderConstraint
    View Source

    StartWith(string)

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

    Declaration
    public StartsWithConstraint StartWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    StartsWithConstraint
    View Source

    StartsWith(string)

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

    Declaration
    public StartsWithConstraint StartsWith(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    StartsWithConstraint
    View Source

    SubPathOf(string)

    Returns a constraint that tests whether the path provided is the a subpath of the expected path after canonicalization.

    Declaration
    public SubPathConstraint SubPathOf(string expected)
    Parameters
    Type Name Description
    string expected
    Returns
    Type Description
    SubPathConstraint
    View Source

    SubsetOf(IEnumerable)

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

    Declaration
    public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
    Parameters
    Type Name Description
    IEnumerable expected
    Returns
    Type Description
    CollectionSubsetConstraint
    View Source

    SupersetOf(IEnumerable)

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

    Declaration
    public CollectionSupersetConstraint SupersetOf(IEnumerable expected)
    Parameters
    Type Name Description
    IEnumerable expected
    Returns
    Type Description
    CollectionSupersetConstraint
    View Source

    ToString()

    Returns a string representation of the expression as it currently stands. This should only be used for testing, since it has the side-effect of resolving the expression.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    View Source

    TypeOf(Type)

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

    Declaration
    public ExactTypeConstraint TypeOf(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    ExactTypeConstraint
    View Source

    TypeOf<TExpected>()

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

    Declaration
    public ExactTypeConstraint TypeOf<TExpected>()
    Returns
    Type Description
    ExactTypeConstraint
    Type Parameters
    Name Description
    TExpected
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0