Partager via


Assert.Fail Method (String)

Fails the assertion without checking any conditions. Displays a message.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

Syntax

'Declaration
Public Shared Sub Fail ( _
    message As String _
)
public static void Fail(
    string message
)
public:
static void Fail(
    String^ message
)
static member Fail : 
        message:string -> unit
public static function Fail(
    message : String
)

Parameters

  • message
    Type: String

    A message to display. This message can be seen in the unit test results.

Exceptions

Exception Condition
AssertFailedException

Always thrown.

.NET Framework Security

See Also

Reference

Assert Class

Fail Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

Other Resources

Using the Assert Classes