Share via


Assert.Instance Property

Definition

Gets the singleton instance of the Assert functionality.

public static Microsoft.VisualStudio.TestTools.UnitTesting.Assert Instance { get; }
static member Instance : Microsoft.VisualStudio.TestTools.UnitTesting.Assert
Public Shared ReadOnly Property Instance As Assert

Property Value

Remarks

Users can use this to plug-in custom assertions through C# extension methods. For instance, the signature of a custom assertion provider could be "public static void IsOfType<T>(this Assert assert, object obj)" Users could then use a syntax similar to the default assertions which in this case is "Assert.Instance.IsOfType<Dog>(animal);" More documentation is at "https://github.com/Microsoft/testfx/docs/README.md".

Applies to