-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIsNotEqual.cs
33 lines (29 loc) · 1.17 KB
/
IsNotEqual.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
26
27
28
29
30
31
32
33
namespace AssertLibrary
{
using System;
using System.Diagnostics;
using System.Globalization;
public static partial class Assert
{
/// <summary>
/// Asserts that the given objects are not equal.
/// </summary>
/// <param name="one">Object to check</param>
/// <param name="another">The other object to check</param>
/// <param name="variableName">Variable name to include in the error message (optional)</param>
public static void IsNotEqual(object one, object another, string variableName = null)
{
if (one == null)
throw new ArgumentNullException("one");
if (another == null)
throw new ArgumentNullException("another");
Check(!one.Equals(another), IsNotEqualMessage(variableName));
}
private static string IsNotEqualMessage(string variableName)
{
return variableName == null ?
string.Format(CultureInfo.CurrentCulture, "Should be equal at this point.") :
string.Format(CultureInfo.CurrentCulture, "\"{0}\" should be equal at this point.", variableName);
}
}
}