1
public async Task<HttpResponseMessage> UpdateUserProfile(HttpPostedFile postedFile)
{
//update operations
}
我有哪里我更新使用HttpPostedFile
一个人的图像的方法UpdateUserProfile。它从Postman/Swagger工作正常。现在我正在写UnitTestCases。我有下面的代码模拟HttpPostedFile在单元测试
public void UpdateUserProfile_WithValidData()
{
HttpPostedFile httpPostedFile;
//httpPostedFile =??
var returnObject = UpdateUserProfile(httpPostedFile);
//Assert code here
}
现在我已经从手工代码,我试图做的,但不能给映像文件HttpPostedFile
对象。请建议我如何在单元测试中进一步进行模拟图像。
这已经得到解决? – Nkosi
都能跟得上@Nkosi我的应用程序专门使用HttpPostedFile,所以没有把它改成HttpPostedFileBase – thecrusader