forked from xunit/assert.xunit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IdentityAsserts.cs
36 lines (34 loc) · 1.22 KB
/
IdentityAsserts.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
34
35
36
using Xunit.Sdk;
namespace Xunit
{
#if XUNIT_VISIBILITY_INTERNAL
internal
#else
public
#endif
partial class Assert
{
/// <summary>
/// Verifies that two objects are not the same instance.
/// </summary>
/// <param name="expected">The expected object instance</param>
/// <param name="actual">The actual object instance</param>
/// <exception cref="NotSameException">Thrown when the objects are the same instance</exception>
public static void NotSame(object expected, object actual)
{
if (object.ReferenceEquals(expected, actual))
throw new NotSameException();
}
/// <summary>
/// Verifies that two objects are the same instance.
/// </summary>
/// <param name="expected">The expected object instance</param>
/// <param name="actual">The actual object instance</param>
/// <exception cref="SameException">Thrown when the objects are not the same instance</exception>
public static void Same(object expected, object actual)
{
if (!object.ReferenceEquals(expected, actual))
throw new SameException(expected, actual);
}
}
}