我正在关注 apress mvc4 收据书,但我正在努力处理以下示例
// act
ViewResult result = controller.Index() as ViewResult;
// assert
Assert.IsInstanceOfType(result.Model,typeof(List<Architect>))
这一行
Assert.IsInstanceOfType(result.Model,typeof(List<Architect>))
抛出两个错误
- 参数 1:无法从对象转换为 System.Type
- Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) 的最佳重载方法匹配有一些无效参数
最佳答案
你需要交换你的论点
Assert.IsInstanceOfType(typeof(List<Architect>),result.Model);
The best overloaded method match for Nunit.Framework.Assert.IsInstanceOfType(System.Type, object) has some invalid arguments
它表示第一个参数是System.Type
,第二个 object
关于c# - Assert.IsInstanceOfType 无法从对象转换为 System.Type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19292005/