Search Results for

    Show / Hide Table of Contents

    Class AnyOfConstraint

    AnyOfConstraint is used to determine whether the value is equal to any of the expected values.

    Inheritance
    object
    Constraint
    AnyOfConstraint
    Implements
    IConstraint
    IResolveConstraint
    Inherited Members
    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.After(int)
    Constraint.After(int, int)
    Constraint.DisplayName
    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 AnyOfConstraint : Constraint, IConstraint, IResolveConstraint

    Constructors

    View Source

    AnyOfConstraint(ICollection)

    Construct a AnyOfConstraint

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

    Collection of expected values

    Properties

    View Source

    Description

    The Description of what this constraint tests, for use in messages and in the ConstraintResult.

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

    IgnoreCase

    Flag the constraint to ignore case and return self.

    Declaration
    public AnyOfConstraint IgnoreCase { get; }
    Property Value
    Type Description
    AnyOfConstraint
    View Source

    IgnoreWhiteSpace

    Flag the constraint to ignore white space and return self.

    Declaration
    public AnyOfConstraint IgnoreWhiteSpace { get; }
    Property Value
    Type Description
    AnyOfConstraint

    Methods

    View Source

    ApplyTo<TActual>(TActual)

    Test whether item is present in expected collection

    Declaration
    public override ConstraintResult ApplyTo<TActual>(TActual actual)
    Parameters
    Type Name Description
    TActual actual

    Actual item

    Returns
    Type Description
    ConstraintResult
    Type Parameters
    Name Description
    TActual

    Actual item type

    Overrides
    Constraint.ApplyTo<TActual>(TActual)
    View Source

    GetStringRepresentation()

    Returns the string representation of this constraint

    Declaration
    protected override string GetStringRepresentation()
    Returns
    Type Description
    string
    Overrides
    Constraint.GetStringRepresentation()
    View Source

    Using(IComparer)

    Flag the constraint to use the supplied IComparer object.

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

    The IComparer object to use.

    Returns
    Type Description
    AnyOfConstraint
    View Source

    Using(IEqualityComparer)

    Flag the constraint to use the supplied IEqualityComparer object.

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

    The IEqualityComparer object to use.

    Returns
    Type Description
    AnyOfConstraint
    View Source

    UsingPropertiesComparer()

    Enables comparing of instance properties.

    Declaration
    public AnyOfConstraint UsingPropertiesComparer()
    Returns
    Type Description
    AnyOfConstraint
    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 object.

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

    The IComparer object to use.

    Returns
    Type Description
    AnyOfConstraint
    Type Parameters
    Name Description
    T
    View Source

    Using<T>(IEqualityComparer<T>)

    Flag the constraint to use the supplied IEqualityComparer object.

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

    The IComparer object to use.

    Returns
    Type Description
    AnyOfConstraint
    Type Parameters
    Name Description
    T
    View Source

    Using<T>(Comparison<T>)

    Flag the constraint to use the supplied Comparison object.

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

    The Comparison object to use.

    Returns
    Type Description
    AnyOfConstraint
    Type Parameters
    Name Description
    T
    View Source

    Using<T>(Func<T, T, bool>)

    Flag the constraint to use the supplied boolean-returning delegate.

    Declaration
    public AnyOfConstraint Using<T>(Func<T, T, bool> comparer)
    Parameters
    Type Name Description
    Func<T, T, bool> comparer

    The supplied boolean-returning delegate to use.

    Returns
    Type Description
    AnyOfConstraint
    Type Parameters
    Name Description
    T

    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