Asp.net mvc 使用MvcIntegrationTestingFramework模拟表单数据中的文件上载
我正在使用Steve Sanderson的MvcIntegrationTestingFramework,并试图模拟上传操作的帖子。第二个参数是一个对象,然后将其转换为要发布的表单数据的名称-值对 我的测试代码是:Asp.net mvc 使用MvcIntegrationTestingFramework模拟表单数据中的文件上载,asp.net-mvc,form-data,Asp.net Mvc,Form Data,我正在使用Steve Sanderson的MvcIntegrationTestingFramework,并试图模拟上传操作的帖子。第二个参数是一个对象,然后将其转换为要发布的表单数据的名称-值对 我的测试代码是: [Test] [Category("integration")] public void UploadRunsCorrectlyWhenConfiguredFromApplicationStart() { var appHost = Ap
[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
}
我的问题是,我应该在这里输入帮助以使运行中的文件不显示为空
谢谢:)