Assert.Scope Yöntem

Tanım

Onay hatalarını hemen oluşturmak yerine toplayan yeni bir onay kapsamı oluşturur. Döndürülen kapsam atıldığında, toplanan tüm hatalar tek AssertFailedExceptionbir olarak oluşturulur.

public static IDisposable Scope();
[System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")]
public static IDisposable Scope();
static member Scope : unit -> IDisposable
[<System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")>]
static member Scope : unit -> IDisposable
Public Shared Function Scope () As IDisposable

Döndürülenler

IDisposable Onay kapsamını temsil eden bir.

Öznitelikler

Örnekler

using (Assert.Scope())
{
    Assert.AreEqual(1, 2);  // collected, not thrown
    Assert.IsTrue(false);   // collected, not thrown
}
// AssertFailedException is thrown here with all collected failures.

Şunlara uygulanır