Compartilhar via


Assert.Fail Method (String, array<Object )

Fails the assertion without checking any conditions. Displays a message, and applies the specified formatting to it.

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, _
    ParamArray parameters As Object() _
)
public static void Fail(
    string message,
    params Object[] parameters
)
public:
static void Fail(
    String^ message, 
    ... array<Object^>^ parameters
)
static member Fail : 
        message:string * 
        parameters:Object[] -> unit
public static function Fail(
    message : String, 
    ... parameters : Object[]
)

Parameters

  • message
    Type: String

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

  • parameters
    Type: array<Object[]

    An array of parameters to use when formatting message.

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