Search Results for

    Show / Hide Table of Contents

    Assertion Helper

    AssertionHelper has been deprecated as of NUnit Framework 3.7. The syntax is now maintained and being enhanced as an independent library, NUnit.StaticExpect.

    Some users prefer a shorter form of assertion than is given by Assert.That. If you derive your test fixture class from AssertionHelper, the Expect() method may be used instead...

    Expect(bool condition);
    Expect(bool condition, string message, params object[] params);
    
    Expect(ActualValueDelegate del, IResolveConstraint constraint)
    Expect(ActualValueDelegate del, IResolveConstraint constraint,
           string message, params object[] params)
    
    Expect<TActual>(TActual actual, IResolveConstraint constraint)
    Expect<TActual>(TActual actual, IResolveConstraint constraint,
                    string message, params object[] params)
    
    Expect(TestDelegate del, IResolveConstraint constraint);
    

    In addition, AssertionHelper allows the derived class to make direct use of many of the syntactic elements that would normally require you to specify the Is, Has or Does class in order to use them. For example, you can write...

    Expect(actual, EqualTo("Hello"));
    

    Use Intellisense to determine which syntactic elements are available in the current release.

    • 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