Search Results for

    Show / Hide Table of Contents

    Class SomeItemsConstraint

    SomeItemsConstraint applies another constraint to each item in a collection, succeeding if any of them succeeds.

    Inheritance
    object
    Constraint
    PrefixConstraint
    SomeItemsConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    PrefixConstraint.BaseConstraint
    PrefixConstraint.DescriptionPrefix
    PrefixConstraint.Description
    Constraint.ApplyTo<TActual>(ActualValueDelegate<TActual>)
    Constraint.ApplyTo<TActual>(ref TActual)
    Constraint.ApplyToAsync<TActual>(Func<Task<TActual>>)
    Constraint.GetTestObject<TActual>(ActualValueDelegate<TActual>)
    Constraint.ToString()
    Constraint.GetStringRepresentation(IEnumerable)
    Constraint.GetStringRepresentation()
    Constraint.After(int)
    Constraint.After(int, int)
    Constraint.Arguments
    Constraint.Builder
    Constraint.And
    Constraint.With
    Constraint.Or
    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 SomeItemsConstraint : PrefixConstraint, IConstraint, IResolveConstraint

    Constructors

    View Source

    SomeItemsConstraint(IConstraint)

    Construct a SomeItemsConstraint on top of an existing constraint

    Declaration
    public SomeItemsConstraint(IConstraint itemConstraint)
    Parameters
    Type Name Description
    IConstraint itemConstraint

    Properties

    View Source

    DisplayName

    The display name of this Constraint for use by ToString(). The default value is the name of the constraint with trailing "Constraint" removed. Derived classes may set this to another name in their constructors.

    Declaration
    public override string DisplayName { get; }
    Property Value
    Type Description
    string
    Overrides
    Constraint.DisplayName

    Methods

    View Source

    ApplyTo<TActual>(TActual)

    Apply the item constraint to each item in the collection, succeeding if any item succeeds.

    Declaration
    public override ConstraintResult ApplyTo<TActual>(TActual actual)
    Parameters
    Type Name Description
    TActual actual
    Returns
    Type Description
    ConstraintResult
    Type Parameters
    Name Description
    TActual
    Overrides
    Constraint.ApplyTo<TActual>(TActual)
    View Source

    Using(IComparer)

    Flag the constraint to use the supplied IComparer object.

    Declaration
    public SomeItemsConstraint Using(IComparer comparer)
    Parameters
    Type Name Description
    IComparer comparer

    The IComparer object to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    View Source

    Using(IEqualityComparer)

    Flag the constraint to use the supplied IEqualityComparer object.

    Declaration
    public SomeItemsConstraint Using(IEqualityComparer comparer)
    Parameters
    Type Name Description
    IEqualityComparer comparer

    The IComparer object to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    View Source

    UsingPropertiesComparer()

    Enables comparing of instance properties.

    Declaration
    public SomeItemsConstraint UsingPropertiesComparer()
    Returns
    Type Description
    SomeItemsConstraint
    Remarks

    This allows comparing classes that don't implement IEquatable<T> without having to compare each property separately in own code.

    View Source

    Using<T>(IComparer<T>)

    Flag the constraint to use the supplied IComparer<T> object.

    Declaration
    public SomeItemsConstraint Using<T>(IComparer<T> comparer)
    Parameters
    Type Name Description
    IComparer<T> comparer

    The IComparer object to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    Type Parameters
    Name Description
    T
    View Source

    Using<T>(IEqualityComparer<T>)

    Flag the constraint to use the supplied IEqualityComparer<T> object.

    Declaration
    public SomeItemsConstraint Using<T>(IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    IEqualityComparer<T> comparer

    The IComparer object to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    Type Parameters
    Name Description
    T
    View Source

    Using<T>(Comparison<T>)

    Flag the constraint to use the supplied Comparison<T> object.

    Declaration
    public SomeItemsConstraint Using<T>(Comparison<T> comparer)
    Parameters
    Type Name Description
    Comparison<T> comparer

    The IComparer object to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    Type Parameters
    Name Description
    T
    View Source

    Using<TActualCollectionElement, TExpected>(Func<TActualCollectionElement, TExpected, bool>)

    Flag the constraint to use the supplied Func<T1, T2, TResult> object.

    Declaration
    public SomeItemsConstraint Using<TActualCollectionElement, TExpected>(Func<TActualCollectionElement, TExpected, bool> comparison)
    Parameters
    Type Name Description
    Func<TActualCollectionElement, TExpected, bool> comparison

    The comparison function to use.

    Returns
    Type Description
    SomeItemsConstraint

    Self.

    Type Parameters
    Name Description
    TActualCollectionElement

    The type of the elements in the collection.

    TExpected

    The type of the expected value.

    Implements

    IConstraint
    IResolveConstraint
    • 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