Assert.Throws Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Throws(IResolveConstraint, TestDelegate, String, Object[])
public static Exception Throws (NUnit.Framework.Constraints.IResolveConstraint expression, NUnit.Framework.TestDelegate code, string message, params object[] args);
static member Throws : NUnit.Framework.Constraints.IResolveConstraint * NUnit.Framework.TestDelegate * string * obj[] -> Exception
Parameters
- expression
- IResolveConstraint
- code
- TestDelegate
- message
- String
- args
- Object[]
Returns
Applies to
Throws(IResolveConstraint, TestDelegate)
public static Exception Throws (NUnit.Framework.Constraints.IResolveConstraint expression, NUnit.Framework.TestDelegate code);
static member Throws : NUnit.Framework.Constraints.IResolveConstraint * NUnit.Framework.TestDelegate -> Exception
Parameters
- expression
- IResolveConstraint
- code
- TestDelegate
Returns
Applies to
Throws(Type, TestDelegate)
public static Exception Throws (Type expectedExceptionType, NUnit.Framework.TestDelegate code);
static member Throws : Type * NUnit.Framework.TestDelegate -> Exception
Parameters
- expectedExceptionType
- Type
- code
- TestDelegate
Returns
Applies to
Throws(IResolveConstraint, TestDelegate, String)
public static Exception Throws (NUnit.Framework.Constraints.IResolveConstraint expression, NUnit.Framework.TestDelegate code, string message);
static member Throws : NUnit.Framework.Constraints.IResolveConstraint * NUnit.Framework.TestDelegate * string -> Exception
Parameters
- expression
- IResolveConstraint
- code
- TestDelegate
- message
- String
Returns
Applies to
Throws(Type, TestDelegate, String)
public static Exception Throws (Type expectedExceptionType, NUnit.Framework.TestDelegate code, string message);
static member Throws : Type * NUnit.Framework.TestDelegate * string -> Exception
Parameters
- expectedExceptionType
- Type
- code
- TestDelegate
- message
- String
Returns
Applies to
Throws(Type, TestDelegate, String, Object[])
public static Exception Throws (Type expectedExceptionType, NUnit.Framework.TestDelegate code, string message, params object[] args);
static member Throws : Type * NUnit.Framework.TestDelegate * string * obj[] -> Exception
Parameters
- expectedExceptionType
- Type
- code
- TestDelegate
- message
- String
- args
- Object[]
Returns
Applies to
Throws<T>(TestDelegate, String)
public static T Throws<T> (NUnit.Framework.TestDelegate code, string message) where T : Exception;
static member Throws : NUnit.Framework.TestDelegate * string -> 'T (requires 'T :> Exception)
Type Parameters
- T
Parameters
- code
- TestDelegate
- message
- String
Returns
T
Applies to
Throws<T>(TestDelegate)
public static T Throws<T> (NUnit.Framework.TestDelegate code) where T : Exception;
static member Throws : NUnit.Framework.TestDelegate -> 'T (requires 'T :> Exception)
Type Parameters
- T
Parameters
- code
- TestDelegate
Returns
T
Applies to
Throws<T>(TestDelegate, String, Object[])
public static T Throws<T> (NUnit.Framework.TestDelegate code, string message, params object[] args) where T : Exception;
static member Throws : NUnit.Framework.TestDelegate * string * obj[] -> 'T (requires 'T :> Exception)
Type Parameters
- T
Parameters
- code
- TestDelegate
- message
- String
- args
- Object[]
Returns
T