By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,969 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,969 IT Pros & Developers. It's quick & easy.

Mocking HttpFileCollection ?

P: n/a
Hi all. In one of our classes I defined a .Files property that exposes
an instance of the HttpFileCollection class. At runtime this instance
will be retrieved from HttpContext.Current.Request.Files.

However, in the unit-testing context, there is no HttpContext to refer
to.
Usually, I'd allow the unit test to set up the instance of the
HttpFileCollection class to be returned by the tested class when
needed. However, HttpFileCollection does not seem to expose a
public .ctor, and it is sealed, so, in my unit tests I can't
instantiate one of them at all /tear.

Any suggestions on how to get around this problem ?

Thanks in advance,
F.

Jun 6 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.