Assert.Scope メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
アサーションエラーを直ちにスローするのではなく収集する新しいアサーション スコープを作成します。 返されたスコープが破棄されると、収集されたすべてのエラーが 1 つの AssertFailedExceptionとしてスローされます。
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.