-
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathFailAsserts.cs
More file actions
32 lines (28 loc) · 723 Bytes
/
FailAsserts.cs
File metadata and controls
32 lines (28 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma warning disable CA1052 // Static holder types should be static
#if XUNIT_NULLABLE
#nullable enable
#else
// In case this is source-imported with global nullable enabled but no XUNIT_NULLABLE
#pragma warning disable CS8625
#endif
using Xunit.Sdk;
#if XUNIT_NULLABLE
using System.Diagnostics.CodeAnalysis;
#endif
namespace Xunit
{
partial class Assert
{
/// <summary>
/// Indicates that the test should immediately fail.
/// </summary>
/// <param name="message">The optional failure message</param>
#if XUNIT_NULLABLE
[DoesNotReturn]
public static void Fail(string? message = null) =>
#else
public static void Fail(string message = null) =>
#endif
throw FailException.ForFailure(message);
}
}