Assert.Scope 메서드

정의

어설션 오류를 즉시 throw하는 대신 수집하는 새 어설션 범위를 만듭니다. 반환된 범위가 삭제되면 수집된 모든 실패가 단일 AssertFailedException로 throw됩니다.

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

반품

IDisposable 어설션 범위를 나타내는 값입니다.

특성

예제

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

적용 대상