1

我正在使用 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
    }

我的问题是我应该在此处输入什么帮助文件不显示为空?

谢谢 :)

4

0 回答 0