2

有没有人在使用 Machine.Specifications.Mvc 时遇到过这个问题?

我设置了一个规范来测试控制器操作的结果。在这种情况下:

[Subject("User views the dashboard")]
public class When_a_user_views_the_vendors_page
     : ManagementContext
{
    static ActionResult result;

    Because of = () => result = manageController.Vendors();

    It should_contain_a_list_of_vendors = () => {

        result.ShouldBeAView().And().ShouldHaveModelOfType<List<Core.Vendor>>();
    };
}

我每次得到的错误是:

Machine.Specifications.SpecificationException:应该是 System.Web.Mvc.ViewResult 类型,但在 d:\BuildAgent-01 中的 Machine.Specifications.ShouldExtensionMethods.ShouldBeOfType(实际对象,预期类型)中是 System.Web.Mvc.ViewResult 类型\work\340c36596c29db8\Source\Machine.Specifications\ExtensionMethods.cs:第 206 行

有人见过这个吗?有没有简单的方法来解决它?它似乎发生在 Machine.Specifications 库中。我什至在调试模式下运行它来检查值,它们确实都是 ViewResult 对象,甚至具有正确的模型数据。

提前致谢

4

1 回答 1

3

好吧...愚蠢的问题。(我知道会这样)。我最近开始尝试使用 MVC2。开箱即用的 Machine.Specifications.Mvc 连接到 1.0;

我将 Machine.Specifications.Mvc 重新引用到 Mvc2,它就像一个魅力。

哦!:)

于 2010-02-23T16:07:35.760 回答