测试ASP.NET MVC网站 [英] Testing ASP.NET MVC website
问题描述
我工作的一个MVC站点的图片上传功能,我想编写一个测试,将上传图片。
I'm working on an MVC site with an image upload capability and I want to write a test that will upload an image.
我做了所谓的TestImage.jpg和设置复制到输出是复制如果较新的图像。在我的测试中,我尝试加载具有以下code:
I made an image called TestImage.jpg and set Copy to Output to be "Copy if Newer". In my test I try to load that with the following code:
System.Drawing.Image testImage = System.Drawing.Image.FromFile(@"TestImage.jpg");
应该不是复制到输出将其复制到同一目录中的测试运行?如果没有,我怎么能找出它复制到?最好是一些项目的根目录的相对路径,所以我可以随意走动的解决方案没有这个破。
Shouldn't the "Copy to Output" copy it to the same directory where the test is running? If not, how can I find out where it was copied to? Best would be some kind of project root relative path so I can feel free to move the solution around without this breaking.
推荐答案
在解决方案资源管理解决方案下的项目双击LocalTestRun.testrunconfig去部署,并添加图片
in the solution explorer Under solution items double click LocalTestRun.testrunconfig go to deployment and add the image
http://img17.imageshack.us/img17/5219/sanstitrelca.jpg
这篇关于测试ASP.NET MVC网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!