Search Results for

    Show / Hide Table of Contents

    Range Constraint

    RangeConstraint tests that a value is in an (inclusive) range.

    Constructor

    RangeConstraint(IComparable from, IComparable to)
    

    Syntax

    Is.InRange(IComparable from, IComparable to)
    

    Modifiers

    ...Using(IComparer comparer)
    ...Using<T>(IComparer<T> comparer)
    ...Using<T>(Comparison<T> comparer)
    

    Examples of Use

    int[] iarray = new int[] { 1, 2, 3 };
    
    Assert.That(42, Is.InRange(1, 100));
    Assert.That(iarray, Is.All.InRange(1, 3));
    Assert.That(myOwnObject, Is.InRange(lowExpected, highExpected).Using(myComparer));
    
    • 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