<Rule Id="xUnit1019" Action="None" /> <!-- MemberData must reference a member providing a valid data type -->
<Rule Id="xUnit1024" Action="None" /> <!-- Test methods cannot have overloads -->
<Rule Id="xUnit1026" Action="None" /> <!-- Theory methods should use all of their parameters -->
- <Rule Id="xUnit2005" Action="None" /> <!-- Do not use identity check on value type -->
<Rule Id="xUnit2013" Action="None" /> <!-- Do not use equality check to check for collection size. -->
<Rule Id="xUnit2017" Action="None" /> <!-- Do not use Contains() to check if a value exists in a collection -->
<Rule Id="xUnit2018" Action="None" /> <!-- Do not compare an object's exact type to an abstract class or interface -->
}
else
{
- Assert.Same(expected, actual); //, message, formattingArgs);
+ Assert.Same((object)expected, (object)actual); //, message, formattingArgs);
}
}
Assert.Equal(value, actualValue);
if (!typeof(T).IsValueType)
{
- Assert.Same(value, actualValue);
+ Assert.Same((object)value, (object)actualValue);
}
}
Assert.Equal(value, actualValue);
if (!typeof(T).IsValueType)
{
- Assert.Same(value, actualValue);
+ Assert.Same((object)value, (object)actualValue);
}
}
Assert.Equal(value, actualValue);
if (!typeof(T).IsValueType)
{
- Assert.Same(value, actualValue);
+ Assert.Same((object)value, (object)actualValue);
}
}
Assert.Equal(value, actualValue);
if (!typeof(T).IsValueType)
{
- Assert.Same(value, actualValue);
+ Assert.Same((object)value, (object)actualValue);
}
}
Assert.Equal(expectedSize.Width, icon.Width);
Assert.Equal(expectedSize.Height, icon.Height);
Assert.Equal(expectedSize, icon.Size);
- Assert.NotSame(sourceIcon.Handle, icon.Handle);
+ Assert.NotEqual(sourceIcon.Handle, icon.Handle);
}
}
Assert.Equal(expectedSize.Width, icon.Width);
Assert.Equal(expectedSize.Height, icon.Height);
Assert.Equal(expectedSize, icon.Size);
- Assert.NotSame(sourceIcon.Handle, icon.Handle);
+ Assert.NotEqual(sourceIcon.Handle, icon.Handle);
}
}
using (Icon clone = Assert.IsType<Icon>(icon.Clone()))
{
Assert.NotSame(icon, clone);
- Assert.NotSame(icon.Handle, clone.Handle);
+ Assert.NotEqual(icon.Handle, clone.Handle);
Assert.Equal(32, clone.Width);
Assert.Equal(32, clone.Height);
Assert.Equal(new Size(32, 32), clone.Size);
using (Icon clone = Assert.IsType<Icon>(icon.Clone()))
{
Assert.NotSame(icon, clone);
- Assert.NotSame(icon.Handle, clone.Handle);
+ Assert.NotEqual(icon.Handle, clone.Handle);
Assert.Equal(SystemIcons.Hand.Width, clone.Width);
Assert.Equal(SystemIcons.Hand.Height, clone.Height);
Assert.Equal(SystemIcons.Hand.Size, clone.Size);
Func<T> f = e.Compile(useInterpreter);
if (default(T) == null)
- Assert.Same(condition ? a : b, f());
+ Assert.Same((object)(condition ? a : b), (object)f());
else
Assert.Equal(condition ? a : b, f());
}
- private static void VerifyGenericWithClassRestriction<Tc>(bool condition, Tc a, Tc b, bool useInterpreter)
+ private static void VerifyGenericWithClassRestriction<Tc>(bool condition, Tc a, Tc b, bool useInterpreter) where Tc : class
{
Expression<Func<Tc>> e =
Expression.Lambda<Func<Tc>>(
Assert.Same(condition ? a : b, f());
}
- private static void VerifyGenericWithSubClassRestriction<TC>(bool condition, TC a, TC b, bool useInterpreter)
+ private static void VerifyGenericWithSubClassRestriction<TC>(bool condition, TC a, TC b, bool useInterpreter) where TC : class
{
Expression<Func<TC>> e =
Expression.Lambda<Func<TC>>(
Assert.Same(condition ? a : b, f());
}
- private static void VerifyGenericWithClassAndNewRestriction<Tcn>(bool condition, Tcn a, Tcn b, bool useInterpreter)
+ private static void VerifyGenericWithClassAndNewRestriction<Tcn>(bool condition, Tcn a, Tcn b, bool useInterpreter) where Tcn : class
{
Expression<Func<Tcn>> e =
Expression.Lambda<Func<Tcn>>(
Assert.Same(condition ? a : b, f());
}
- private static void VerifyGenericWithSubClassAndNewRestriction<TCn>(bool condition, TCn a, TCn b, bool useInterpreter)
+ private static void VerifyGenericWithSubClassAndNewRestriction<TCn>(bool condition, TCn a, TCn b, bool useInterpreter) where TCn : class
{
Expression<Func<TCn>> e =
Expression.Lambda<Func<TCn>>(
memory.Validate(expected);
}
- private static void CastReference<T>(Memory<T> memory, params T[] expected)
+ private static void CastReference<T>(Memory<T> memory, params T[] expected) where T : class
{
memory.ValidateReferenceType(expected);
}
memory.Validate(expected);
}
- private static void CastReadOnlyReference<T>(ReadOnlyMemory<T> memory, params T[] expected)
+ private static void CastReadOnlyReference<T>(ReadOnlyMemory<T> memory, params T[] expected) where T : class
{
memory.ValidateReferenceType(expected);
}
memory.Validate(expected);
}
- private static void CastReadOnlyReference<T>(ReadOnlyMemory<T> memory, params T[] expected)
+ private static void CastReadOnlyReference<T>(ReadOnlyMemory<T> memory, params T[] expected) where T : class
{
memory.ValidateReferenceType(expected);
}
Assert.True(span.SequenceEqual(expected));
}
- public static void ValidateReferenceType<T>(this Span<T> span, params T[] expected)
+ public static void ValidateReferenceType<T>(this Span<T> span, params T[] expected) where T : class
{
Assert.Equal(span.Length, expected.Length);
for (int i = 0; i < expected.Length; i++)
Assert.True(span.SequenceEqual(expected));
}
- public static void ValidateReferenceType<T>(this ReadOnlySpan<T> span, params T[] expected)
+ public static void ValidateReferenceType<T>(this ReadOnlySpan<T> span, params T[] expected) where T : class
{
Assert.Equal(span.Length, expected.Length);
for (int i = 0; i < expected.Length; i++)
Assert.True(memory.Span.SequenceEqual(expected));
}
- public static void ValidateReferenceType<T>(this Memory<T> memory, params T[] expected)
+ public static void ValidateReferenceType<T>(this Memory<T> memory, params T[] expected) where T : class
{
T[] bufferArray = memory.ToArray();
Assert.Equal(memory.Length, expected.Length);
Assert.True(memory.Span.SequenceEqual(expected));
}
- public static void ValidateReferenceType<T>(this ReadOnlyMemory<T> memory, params T[] expected)
+ public static void ValidateReferenceType<T>(this ReadOnlyMemory<T> memory, params T[] expected) where T : class
{
T[] bufferArray = memory.ToArray();
Assert.Equal(memory.Length, expected.Length);
}
else
{
- Assert.Same(value, rv);
+ Assert.Same((object)value, rv);
}
}
private static void ValidateEnumerator<TEnumerator, TCurrent>(
Func<OidCollection, TEnumerator> getEnumerator,
- Func<TEnumerator, TCurrent> getCurrent) where TEnumerator : IEnumerator
+ Func<TEnumerator, TCurrent> getCurrent)
+ where TEnumerator : IEnumerator
+ where TCurrent : class
{
var item1 = new Oid(Sha1Oid, Sha1Name);
var item2 = new Oid(Sha256Oid, Sha256Name);
#pragma warning restore 618
var _handle = new ManualResetEvent(false).SafeWaitHandle;
- Assert.NotSame(IntPtr.Zero, obj.EventHandleIntPtr);
+ Assert.NotEqual(IntPtr.Zero, obj.EventHandleIntPtr);
obj.EventHandleIntPtr = _handle.DangerousGetHandle();
Assert.Equal(_handle.DangerousGetHandle(), obj.EventHandleIntPtr);
if (typeof(T).GetTypeInfo().IsValueType)
Assert.Equal(expected.Result, actual.Result);
else
- Assert.Same(expected.Result, actual.Result);
+ Assert.Same((object)expected.Result, (object)actual.Result);
}
}