开发者

Unit test which requires a file in Request.Files

开发者 https://www.devze.com 2023-03-17 16:03 出处:网络
I\'m writing a unit test and the piece of code its testing requires that a file be in Request.Files. In my controller I\'m c开发者_运维知识库alling something called AddDocument(file) and the file is

I'm writing a unit test and the piece of code its testing requires that a file be in Request.Files.

In my controller I'm c开发者_运维知识库alling something called AddDocument(file) and the file is taken from Request.Files.

How do you achieve unit testing this? Isn't the Request only available in the controller?


check out this blog by scott hanselman on the topic. its pretty informative and well written.

0

精彩评论

暂无评论...
验证码 换一张
取 消