ull*_*ark 7 c# structuremap bdd specflow asp.net-mvc-3
我正在使用ASP.NET MVC 3构建REST API.我正在使用SpecFlow和NUnit作为测试运行器来实现BDD风格.
由于它是一个REST API,因此测试Url:s显然非常重要,因此我希望能够在规范中进行真正的HTTP调用.
我现在正在寻找有关如何实现Cross Process Mocking的技巧.简而言之,我想用我在Specs中生成的实体来模拟数据层.
在Rails应用程序中,我会使用Webrat.有没有相当于.NET的东西呢?
我已经尝试过Deleporter,但它似乎无法"发送"高级构造(在规范中创建一个简单的字符串并在Deleporter中使用它,但不适用于自定义类,属性都变为null)
有没有人有关于如何做到这一点的经验或提示?
编辑:我在Deleporter尝试做的事情是这样的(我知道我可以在Deleporter代码中生成模型,但这是一个简化的例子,所以这对我不起作用):
var models = Builder<Foo>.CreateListOfSize(300);
Deleporter.Run(() =>
{
var mockService = new Mock<IFooService>();
// Models will be a list of 300 Foos but the foos properties will all be null
mockService.Setup(s => s.GetStuff()).Returns(models);
ObjectFactory.Inject(mockService.Object);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
632 次 |
| 最近记录: |