-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIsFalse.cs
25 lines (23 loc) · 848 Bytes
/
IsFalse.cs
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
namespace AssertLibrary
{
using System.Diagnostics;
using System.Globalization;
public static partial class Assert
{
/// <summary>
/// Asserts that the given flag is false.
/// </summary>
/// <param name="flag">Flag to check</param>
/// <param name="variableName">Variable name to include in the error message (optional)</param>
public static void IsFalse(bool flag, string variableName = null)
{
Check(!flag, IsFalseMessage(variableName));
}
private static string IsFalseMessage(string variableName)
{
return variableName == null ?
"Shouldn't be false at this point." :
string.Format(CultureInfo.CurrentCulture, "\"{0}\" shouldn't be false at this point.", variableName);
}
}
}