我正在使用Steve Sanderson的MvcIntegrationTestingFramework并尝试模拟上传动作的帖子。第二个参数是一个对象,然后将其转换为要发布的表单数据的名称值对。
我的测试代码是:
[Test]
[Category("integration")]
public void UploadRunsCorrectlyWhenConfiguredFromApplicationStart()
{
var appHost = AppHost.Simulate("ingester");
appHost.Start(session =>
{
var result = session.Post("upload/upload",
new
{
id = Guid.NewGuid().ToString(),
file = ***Help here ***
});
Assert.That(result.Response.StatusCode == 202);
} );
}
行动是:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Upload(string id, HttpPostedFileBase file)
{
//Need file to not be null here
}
我的问题是我应该在 帮助 中添加哪些文件才能显示为空?
谢谢:)