我可以断言返回的ActionResult的类型,但我似乎不知道如何将结果与我正在创建的夹具进行比较。我已经调试了单元测试,并看到CreatedAtAction调用正在返回一个ActionResult。顶层值为null。但是,结果的值有项。我觉得我错过了一个转换或什么的,我的代码应该期待一个CreatedAtActionResult或其他什么,但我似乎不知道如何使它工作。<TodoItem>>(result); // WORKS
public ActionResult SomeAction(int?id) MyModel model = new MyModel();}
检查视图是否已初始化基本上,我如何在单元测试中模拟这个MyModel?res = this.controller.SomeAction() as ViewResult;
Assert.IsNotNull(res