Show / Hide Table of Contents

Class ThrowsException

Exception thrown when code unexpectedly fails to throw an exception.

Inheritance
Object
XunitException
AssertActualExpectedException
ThrowsException
Inherited Members
AssertActualExpectedException.Actual
AssertActualExpectedException.ActualTitle
AssertActualExpectedException.Expected
AssertActualExpectedException.ExpectedTitle
AssertActualExpectedException.Message
XunitException.UserMessage
XunitException.ToString()
Namespace: Xunit.Sdk
Assembly: xunit.assert.dll
Syntax
public class ThrowsException : AssertActualExpectedException

Constructors

| Improve this Doc View Source

ThrowsException(Type)

Creates a new instance of the ThrowsException class. Call this constructor when no exception was thrown.

Declaration
public ThrowsException(Type expectedType)
Parameters
Type Name Description
Type expectedType

The type of the exception that was expected

| Improve this Doc View Source

ThrowsException(Type, Exception)

Creates a new instance of the ThrowsException class. Call this constructor when an exception of the wrong type was thrown.

Declaration
public ThrowsException(Type expectedType, Exception actual)
Parameters
Type Name Description
Type expectedType

The type of the exception that was expected

Exception actual

The actual exception that was thrown

| Improve this Doc View Source

ThrowsException(Type, String, String, String, Exception)

THIS CONSTRUCTOR IS FOR UNIT TESTING PURPOSES ONLY.

Declaration
protected ThrowsException(Type expected, string actual, string actualMessage, string stackTrace, Exception innerException)
Parameters
Type Name Description
Type expected
String actual
String actualMessage
String stackTrace
Exception innerException

Properties

| Improve this Doc View Source

StackTrace

Gets a string representation of the frames on the call stack at the time the current exception was thrown.

Declaration
public override string StackTrace { get; }
Property Value
Type Description
String

A string that describes the contents of the call stack, with the most recent method call appearing first.

Overrides
XunitException.StackTrace
  • Improve this Doc
  • View Source
Back to top Generated by DocFX