3

私はapress mvc4の領収書に従っていますが、次の例に苦労しています

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

この行

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

2つのエラーをスローします

  1. Argument1: オブジェクトから System.Type に変換できません
  2. Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) に最適なオーバーロードされたメソッドの一致には、いくつかの無効な引数があります
4

1 に答える 1

3

引数を交換する必要があります

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

Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) に最適なオーバーロードされたメソッドの一致には、いくつかの無効な引数があります

最初の引数はSystem.Type2番目 object

于 2013-10-10T09:35:00.010 に答える