Search Results for

    Show / Hide Table of Contents

    Class EqualTimeBaseConstraint<T>

    EqualConstraint is able to compare an actual value with the expected value provided in its constructor. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types.

    Inheritance
    object
    Constraint
    EqualTimeBaseConstraint<T>
    EqualDateTimeOffsetConstraint
    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.GetStringRepresentation()
    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 EqualTimeBaseConstraint<T> : Constraint, IConstraint, IResolveConstraint where T : struct, IEquatable<T>, IComparable<T>
    Type Parameters
    Name Description
    T

    Constructors

    View Source

    EqualTimeBaseConstraint(T, Func<T, long>)

    Initializes a new instance of the EqualConstraint class.

    Declaration
    public EqualTimeBaseConstraint(T expected, Func<T, long> getTicks)
    Parameters
    Type Name Description
    T expected

    The expected value.

    Func<T, long> getTicks

    Method to extract the Ticks from an instance of T.

    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

    Expected

    Gets the expected value.

    Declaration
    public T Expected { get; }
    Property Value
    Type Description
    T

    Methods

    View Source

    ApplyTo(T)

    Test whether the constraint is satisfied by a given value

    Declaration
    public virtual ConstraintResult ApplyTo(T actual)
    Parameters
    Type Name Description
    T actual

    The value to be tested

    Returns
    Type Description
    ConstraintResult

    True for success, false for failure

    View Source

    ApplyTo<TActual>(TActual)

    Test whether the constraint is satisfied by a given value

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

    The value to be tested

    Returns
    Type Description
    ConstraintResult

    True for success, false for failure

    Type Parameters
    Name Description
    TActual
    Overrides
    Constraint.ApplyTo<TActual>(TActual)
    View Source

    Within(double)

    Flag the constraint to use a tolerance when determining equality.

    Declaration
    public EqualTimeBasedConstraintWithNumericTolerance<T> Within(double amount)
    Parameters
    Type Name Description
    double amount

    Tolerance value to be used

    Returns
    Type Description
    EqualTimeBasedConstraintWithNumericTolerance<T>

    Self.

    View Source

    Within(TimeSpan)

    Flag the constraint to use a tolerance when determining equality.

    Declaration
    public EqualTimeBasedConstraintWithTimeSpanTolerance<T> Within(TimeSpan amount)
    Parameters
    Type Name Description
    TimeSpan amount

    Tolerance value to be used

    Returns
    Type Description
    EqualTimeBasedConstraintWithTimeSpanTolerance<T>

    Self.

    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