Assert.Fail Method

Definition

Overloads

Fail()

Throws an AssertFailedException.

Fail(String)

Throws an AssertFailedException.

Fail(String, Object[])

Throws an AssertFailedException.

Fail()

Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs

Throws an AssertFailedException.

C#
public static void Fail();

Exceptions

Always thrown.

Applies to

MSTest.TestFramework 3.8.0 et autres versions
Produit Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

Fail(String)

Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs

Throws an AssertFailedException.

C#
public static void Fail(string message);
C#
public static void Fail(string? message);

Parameters

message
String

The message to include in the exception. The message is shown in test results.

Exceptions

Always thrown.

Applies to

MSTest.TestFramework 3.8.0 et autres versions
Produit Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0

Fail(String, Object[])

Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs
Source:
Assert.Fail.cs

Throws an AssertFailedException.

C#
public static void Fail(string message, params object[] parameters);
C#
public static void Fail(string? message, params object?[]? parameters);

Parameters

message
String

The message to include in the exception. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Always thrown.

Applies to

MSTest.TestFramework 3.8.0 et autres versions
Produit Versions
MSTest.TestFramework 1.1.18, 1.2.1, 1.3.2, 1.4.0, 2.2.0, 2.1.2, 2.2.10, 3.0.4, 3.1.1, 3.2.2, 3.3.1, 3.4.3, 3.5.1, 3.6.4, 3.7.3, 3.8.0