Search Results for

    Show / Hide Table of Contents

    LessThanOrEqual Constraint

    LessThanOrEqualConstraint tests that one value is less than or equal to another.

    Constructor

    LessThanOrEqualConstraint(object expected)
    

    Syntax

    Is.LessThanOrEqualTo(object expected)
    Is.AtMost(object expected)
    

    Modifiers

    ...Using(IComparer comparer)
    ...Using<T>(IComparer<T> comparer)
    ...Using<T>(Comparison<T> comparer)
    ...Within(object tolerance)
    

    Examples of Use

    Assert.That(3, Is.LessThanOrEqualTo(7));
    Assert.That(3, Is.AtMost(7));
    Assert.That(3, Is.LessThanOrEqualTo(3));
    Assert.That(3, Is.AtMost(3));
    Assert.That(myOwnObject, Is.LessThanOrEqualTo(theExpected).Using(myComparer));
    Assert.That(myDateTime, Is.LessThanOrEqualTo(expectedDateTime).Within(TimeSpan.FromSeconds(1)))
    
    • Edit this page
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0