`
Search Results for

    Show / Hide Table of Contents

    Assert.Negative

    Asserts that a number is negative.

    //true
    Assert.Negative(-1);
    //false
    Assert.Negative(1);
    

    All the overloads of the method are

    Assert.Negative(int actual);
    Assert.Negative(int actual, string message, params object[] args);
    
    Assert.Negative(uint actual);
    Assert.Negative(uint actual, string message, params object[] args);
    
    Assert.Negative(long actual);
    Assert.Negative(long actual, string message, params object[] args);
    
    Assert.Negative(ulong actual);
    Assert.Negative(ulong actual, string message, params object[] args);
    
    Assert.Negative(decimal actual);
    Assert.Negative(decimal actual, string message, params object[] args);
    
    Assert.Negative(double actual);
    Assert.Negative(double actual, string message, params object[] args);
    
    Assert.Negative(float actual);
    Assert.Negative(float actual, string message, params object[] args);
    

    You may also use Assert.That with a Is.Negative constraint to achieve the same result.

    See Also

    • Assert.Positive
    • Assert.Zero
    • Assert.NotZero
    • Assert.IsNaN
    • Improve this Doc
    In This Article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0