473,468 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.

Jun 6 '07 #1
0 1271

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Plummer | last post by:
Hi, I am trying to adopt TDD. I have a client Application that retrieves some data from a web service. To help with testing I want to use dependency injection and mock the web service. This...
1
by: pbd22 | last post by:
hi. i am having probs accessing the HttpFileCollection. the count/length is always zero. i have tried getting the url of the current form, and it checks out... looks like this: ...
0
by: pbd22 | last post by:
hi. i am having probs accessing the HttpFileCollection. the count/length is always zero. the file upload parameters passed to the page that should be getting the httpfilecollection looks like...
7
by: PaoloB | last post by:
Hi everyone, during our development, we need to write some unit tests that interact with OpenOffice through pyUno. Is there anyone who has got any experience on it? As OpenOffice is quite a...
10
by: gamename | last post by:
Hi, Currently, I'm using CUnit as a unit test tool. But there is one thing it really lacks: function mocking. In other words, changing what really gets called in subordinate routines so that a...
6
by: Silfheed | last post by:
Heyas So we have the following situation: we have a testee.py that we want to automatically test out and verifiy that it is worthy of being deployed. We want our tester.py to test the code for...
3
by: andho | last post by:
I need to mock a resource like a directory in one of my unit tests. The method is checking if the directory exists and i don't want to create a directory just for testing purposes so is there anyway...
0
by: mo.sparrow | last post by:
The advantages of unit testing are well known, giving development teams a safety net to facilitate change, ease integration and supply live documentation.Unit testing of small logical code is quite...
0
by: mo.sparrow | last post by:
The advantages of unit testing are well known, giving development teams a safety net to facilitate change, ease integration and supply live documentation.Unit testing of small logical code is quite...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.