From e17afb4b638f96431d836df879c24f59d78800ab Mon Sep 17 00:00:00 2001 From: Shreyas R Date: Mon, 17 Jun 2019 17:02:27 +0530 Subject: [PATCH 1/5] Update Assert.cs --- src/TestFramework/MSTest.Core/Assertions/Assert.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TestFramework/MSTest.Core/Assertions/Assert.cs b/src/TestFramework/MSTest.Core/Assertions/Assert.cs index 7ee7c491fd..e308e2ae9e 100644 --- a/src/TestFramework/MSTest.Core/Assertions/Assert.cs +++ b/src/TestFramework/MSTest.Core/Assertions/Assert.cs @@ -1754,10 +1754,15 @@ public static void IsNotInstanceOfType(object value, Type wrongType, string mess /// 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); } + + if (value == null) + { + return; + } var elementTypeInfo = value.GetType().GetTypeInfo(); var expectedTypeInfo = wrongType.GetTypeInfo(); From 8092175e431025ed5f81dac0c5407ceee5644652 Mon Sep 17 00:00:00 2001 From: Shreyas R Date: Tue, 18 Jun 2019 13:49:20 +0530 Subject: [PATCH 2/5] Update Assert.cs --- src/TestFramework/MSTest.Core/Assertions/Assert.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestFramework/MSTest.Core/Assertions/Assert.cs b/src/TestFramework/MSTest.Core/Assertions/Assert.cs index e308e2ae9e..2de476f5ea 100644 --- a/src/TestFramework/MSTest.Core/Assertions/Assert.cs +++ b/src/TestFramework/MSTest.Core/Assertions/Assert.cs @@ -1758,7 +1758,7 @@ public static void IsNotInstanceOfType(object value, Type wrongType, string mess { HandleFail("Assert.IsNotInstanceOfType", message, parameters); } - + if (value == null) { return; From fdeb2cfc2fcdb421b2c1358ecd579798378827c5 Mon Sep 17 00:00:00 2001 From: Shreyas R Date: Tue, 18 Jun 2019 13:59:12 +0530 Subject: [PATCH 3/5] Update AssertTests.cs --- test/UnitTests/MSTest.Core.Unit.Tests/Assertions/AssertTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/UnitTests/MSTest.Core.Unit.Tests/Assertions/AssertTests.cs b/test/UnitTests/MSTest.Core.Unit.Tests/Assertions/AssertTests.cs index 4e84da6e23..dc64211915 100644 --- a/test/UnitTests/MSTest.Core.Unit.Tests/Assertions/AssertTests.cs +++ b/test/UnitTests/MSTest.Core.Unit.Tests/Assertions/AssertTests.cs @@ -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] From 36c9748d0bbfab2e00cc3e1745199bc4a322d58c Mon Sep 17 00:00:00 2001 From: Shreyas R Date: Tue, 18 Jun 2019 14:11:25 +0530 Subject: [PATCH 4/5] Update Assert.cs --- src/TestFramework/MSTest.Core/Assertions/Assert.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TestFramework/MSTest.Core/Assertions/Assert.cs b/src/TestFramework/MSTest.Core/Assertions/Assert.cs index 2de476f5ea..3bdf41a64a 100644 --- a/src/TestFramework/MSTest.Core/Assertions/Assert.cs +++ b/src/TestFramework/MSTest.Core/Assertions/Assert.cs @@ -1758,7 +1758,8 @@ public static void IsNotInstanceOfType(object value, Type wrongType, string mess { HandleFail("Assert.IsNotInstanceOfType", message, parameters); } - + + // Null is not an instance of any type. if (value == null) { return; From 2037b71e30c52d4823c79f4eefce8f2ef2ff94cc Mon Sep 17 00:00:00 2001 From: Shreyas R Date: Tue, 18 Jun 2019 14:19:27 +0530 Subject: [PATCH 5/5] Update Assert.cs --- src/TestFramework/MSTest.Core/Assertions/Assert.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestFramework/MSTest.Core/Assertions/Assert.cs b/src/TestFramework/MSTest.Core/Assertions/Assert.cs index 3bdf41a64a..25176aecf7 100644 --- a/src/TestFramework/MSTest.Core/Assertions/Assert.cs +++ b/src/TestFramework/MSTest.Core/Assertions/Assert.cs @@ -1758,7 +1758,7 @@ public static void IsNotInstanceOfType(object value, Type wrongType, string mess { HandleFail("Assert.IsNotInstanceOfType", message, parameters); } - + // Null is not an instance of any type. if (value == null) {