Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/TestFramework/TestFramework/Assertions/Assert.AreSame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public sealed partial class Assert
/// Tests whether the specified objects both refer to the same object and
/// throws an exception if the two inputs do not refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="expected">
/// The first object to compare. This is the value the test expects.
/// </param>
Expand All @@ -27,7 +30,7 @@ public sealed partial class Assert
/// Thrown if <paramref name="expected"/> does not refer to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreSame(object? expected, object? actual)
public static void AreSame<T>(T? expected, T? actual)
{
AreSame(expected, actual, string.Empty, null);
}
Expand All @@ -36,6 +39,9 @@ public static void AreSame(object? expected, object? actual)
/// Tests whether the specified objects both refer to the same object and
/// throws an exception if the two inputs do not refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="expected">
/// The first object to compare. This is the value the test expects.
/// </param>
Expand All @@ -51,7 +57,7 @@ public static void AreSame(object? expected, object? actual)
/// Thrown if <paramref name="expected"/> does not refer to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreSame(object? expected, object? actual, string? message)
public static void AreSame<T>(T? expected, T? actual, string? message)
{
AreSame(expected, actual, message, null);
}
Expand All @@ -60,6 +66,9 @@ public static void AreSame(object? expected, object? actual, string? message)
/// Tests whether the specified objects both refer to the same object and
/// throws an exception if the two inputs do not refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="expected">
/// The first object to compare. This is the value the test expects.
/// </param>
Expand All @@ -78,7 +87,7 @@ public static void AreSame(object? expected, object? actual, string? message)
/// Thrown if <paramref name="expected"/> does not refer to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreSame(object? expected, object? actual, string? message, params object?[]? parameters)
public static void AreSame<T>(T? expected, T? actual, string? message, params object?[]? parameters)
{
if (ReferenceEquals(expected, actual))
{
Expand Down Expand Up @@ -106,6 +115,9 @@ public static void AreSame(object? expected, object? actual, string? message, pa
/// Tests whether the specified objects refer to different objects and
/// throws an exception if the two inputs refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="notExpected">
/// The first object to compare. This is the value the test expects not
/// to match <paramref name="actual"/>.
Expand All @@ -117,7 +129,7 @@ public static void AreSame(object? expected, object? actual, string? message, pa
/// Thrown if <paramref name="notExpected"/> refers to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreNotSame(object? notExpected, object? actual)
public static void AreNotSame<T>(T? notExpected, T? actual)
{
AreNotSame(notExpected, actual, string.Empty, null);
}
Expand All @@ -126,6 +138,9 @@ public static void AreNotSame(object? notExpected, object? actual)
/// Tests whether the specified objects refer to different objects and
/// throws an exception if the two inputs refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="notExpected">
/// The first object to compare. This is the value the test expects not
/// to match <paramref name="actual"/>.
Expand All @@ -142,7 +157,7 @@ public static void AreNotSame(object? notExpected, object? actual)
/// Thrown if <paramref name="notExpected"/> refers to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreNotSame(object? notExpected, object? actual, string? message)
public static void AreNotSame<T>(T? notExpected, T? actual, string? message)
{
AreNotSame(notExpected, actual, message, null);
}
Expand All @@ -151,6 +166,9 @@ public static void AreNotSame(object? notExpected, object? actual, string? messa
/// Tests whether the specified objects refer to different objects and
/// throws an exception if the two inputs refer to the same object.
/// </summary>
/// <typeparam name="T">
/// The type of values to compare.
/// </typeparam>
/// <param name="notExpected">
/// The first object to compare. This is the value the test expects not
/// to match <paramref name="actual"/>.
Expand All @@ -170,7 +188,7 @@ public static void AreNotSame(object? notExpected, object? actual, string? messa
/// Thrown if <paramref name="notExpected"/> refers to the same object
/// as <paramref name="actual"/>.
/// </exception>
public static void AreNotSame(object? notExpected, object? actual, string? message, params object?[]? parameters)
public static void AreNotSame<T>(T? notExpected, T? actual, string? message, params object?[]? parameters)
{
if (ReferenceEquals(notExpected, actual))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,6 @@ static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotEqual(string? n
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotEqual<T>(T? notExpected, T? actual) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotEqual<T>(T? notExpected, T? actual, string? message) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotEqual<T>(T? notExpected, T? actual, string? message, params object?[]? parameters) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame(object? notExpected, object? actual) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame(object? notExpected, object? actual, string? message) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame(object? notExpected, object? actual, string? message, params object?[]? parameters) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame(object? expected, object? actual) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame(object? expected, object? actual, string? message) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame(object? expected, object? actual, string? message, params object?[]? parameters) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Equals(object? objA, object? objB) -> bool
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail() -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail(string? message) -> void
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
virtual Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.GetDisplayName(System.Reflection.MethodInfo! methodInfo, object?[]? data) -> string?
virtual Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.GetDisplayName(System.Reflection.MethodInfo! methodInfo, object?[]? data) -> string?
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame<T>(T? expected, T? actual) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame<T>(T? expected, T? actual, string? message) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreSame<T>(T? expected, T? actual, string? message, params object?[]? parameters) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame<T>(T? notExpected, T? actual) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame<T>(T? notExpected, T? actual, string? message) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreNotSame<T>(T? notExpected, T? actual, string? message, params object?[]? parameters) -> void