Skip to content

Assert.IsInstanceOf passes on value null #178

@LarsCelie

Description

@LarsCelie

Description

Assert.IsInstanceOfType succeeds when value is null, while the MSDN specifies it should throw an error.
AssertFailedException : 'value is null or expectedType is not found in the inheritance hierarchy of value.'
https://msdn.microsoft.com/en-us/library/ms243733.aspx

Steps to reproduce

Create a standard .net core test project from visual studio 2017, and create a dummy class. then use the following method:
public void TestMethod1() { Assert.IsInstanceOfType(null, typeof(Dummy)); }

Expected behavior

The test should throw AssertFailedException and fail

Actual behavior

The test passes

Environment

Windows Server 2016,
MSTest.Framework version 1.1.11 and 1.1.17
MSTest.TestAdapter version 1.1.11 and 1.1.17

Metadata

Metadata

Assignees

Labels

Help-WantedThe issue is up-for-grabs, and can be claimed by commenting

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions