Search Results for

    Show / Hide Table of Contents

    Class Throws

    Helper class with properties and methods that supply constraints that operate on exceptions.

    Inheritance
    object
    Throws
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework
    Assembly: nunit.framework.dll
    Syntax
    public abstract class Throws

    Constructors

    View Source

    Throws()

    Declaration
    protected Throws()

    Properties

    View Source

    ArgumentException

    Creates a constraint specifying an expected ArgumentException

    Declaration
    public static ExactTypeConstraint ArgumentException { get; }
    Property Value
    Type Description
    ExactTypeConstraint
    View Source

    ArgumentNullException

    Creates a constraint specifying an expected ArgumentNullException

    Declaration
    public static ExactTypeConstraint ArgumentNullException { get; }
    Property Value
    Type Description
    ExactTypeConstraint
    View Source

    Exception

    Creates a constraint specifying an expected exception

    Declaration
    public static ResolvableConstraintExpression Exception { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    InnerException

    Creates a constraint specifying an exception with a given InnerException

    Declaration
    public static ResolvableConstraintExpression InnerException { get; }
    Property Value
    Type Description
    ResolvableConstraintExpression
    View Source

    InvalidOperationException

    Creates a constraint specifying an expected InvalidOperationException

    Declaration
    public static ExactTypeConstraint InvalidOperationException { get; }
    Property Value
    Type Description
    ExactTypeConstraint
    View Source

    Nothing

    Creates a constraint specifying that no exception is thrown

    Declaration
    public static ThrowsNothingConstraint Nothing { get; }
    Property Value
    Type Description
    ThrowsNothingConstraint
    View Source

    TargetInvocationException

    Creates a constraint specifying an expected TargetInvocationException

    Declaration
    public static ExactTypeConstraint TargetInvocationException { get; }
    Property Value
    Type Description
    ExactTypeConstraint

    Methods

    View Source

    InstanceOf(Type)

    Creates a constraint specifying the type of exception expected

    Declaration
    public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    InstanceOfTypeConstraint
    View Source

    InstanceOf<TExpected>()

    Creates a constraint specifying the type of exception expected

    Declaration
    public static InstanceOfTypeConstraint InstanceOf<TExpected>() where TExpected : Exception
    Returns
    Type Description
    InstanceOfTypeConstraint
    Type Parameters
    Name Description
    TExpected
    View Source

    TypeOf(Type)

    Creates a constraint specifying the exact type of exception expected

    Declaration
    public static ExactTypeConstraint TypeOf(Type expectedType)
    Parameters
    Type Name Description
    Type expectedType
    Returns
    Type Description
    ExactTypeConstraint
    View Source

    TypeOf<TExpected>()

    Creates a constraint specifying the exact type of exception expected

    Declaration
    public static ExactTypeConstraint TypeOf<TExpected>() where TExpected : Exception
    Returns
    Type Description
    ExactTypeConstraint
    Type Parameters
    Name Description
    TExpected
    • 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