Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 7 additions & 1 deletion src/TestFramework/MSTest.Core/Assertions/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,10 +1754,16 @@ public static void IsNotInstanceOfType(object value, Type wrongType, string mess
/// </exception>
public static void IsNotInstanceOfType(object value, Type wrongType, string message, params object[] parameters)
{
if (wrongType == null || value == null)
if (wrongType == null)
{
HandleFail("Assert.IsNotInstanceOfType", message, parameters);
}

// Null is not an instance of any type.
if (value == null)
{
return;
}

var elementTypeInfo = value.GetType().GetTypeInfo();
var expectedTypeInfo = wrongType.GetTypeInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ public void InstanceOfTypeShouldPassOnHigherInstance()
public void InstanceNotOfTypeShouldFailWhenValueIsNull()
{
Action action = () => TestFrameworkV2.Assert.IsNotInstanceOfType(null, typeof(AssertTests));
ActionUtility.ActionShouldThrowExceptionOfType(action, typeof(TestFrameworkV2.AssertFailedException));
}

[TestMethod]
Expand Down