panjo
panjo

Reputation: 3515

Assert.IsInstanceOfType cannot convert from object to System.Type

I'm following apress mvc4 receipts book and I'm struggle with following example

// act
ViewResult result = controller.Index() as ViewResult;
// assert
Assert.IsInstanceOfType(result.Model,typeof(List<Architect>))

this line

Assert.IsInstanceOfType(result.Model,typeof(List<Architect>))

throws two errors

  1. Argument1: cannot convert from object to System.Type
  2. The best overloaded method match for Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) has some invalid arguments

Upvotes: 3

Views: 1156

Answers (1)

Kamil Budziewski
Kamil Budziewski

Reputation: 23107

you need to swap your arguments

Assert.IsInstanceOfType(typeof(List<Architect>),result.Model);

The best overloaded method match for Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) has some invalid arguments

It says that first argument is System.Type, second object

Upvotes: 3

Related Questions