Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Mocking HttpFileCollection ?


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.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc