Mocking HttpFileCollection ?

O

Olorin

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top