473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Any way to create HttpPosted File?

I am writing a unit test for the class that will take a HttpPostedFile in of
it methods as a parameter. I need to pass this parameter to the method in
the test but I don't see any way to create this file using C#.
I understand that from security point of view it makes sense but I got to
write this test unless it's impossible.
Thanks,
Shimon.
Nov 18 '05 #1
3 4474
I don't think you'll be able to do anything in an automatic/programmatic
fashion...

Karl

"Shimon Sim" <es*****@att.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am writing a unit test for the class that will take a HttpPostedFile in of it methods as a parameter. I need to pass this parameter to the method in
the test but I don't see any way to create this file using C#.
I understand that from security point of view it makes sense but I got to
write this test unless it's impossible.
Thanks,
Shimon.

Nov 18 '05 #2
Karl
Thanks for both answers.
Shimon.
"Karl" <none> wrote in message
news:e0****************@TK2MSFTNGP11.phx.gbl...
I don't think you'll be able to do anything in an automatic/programmatic
fashion...

Karl

"Shimon Sim" <es*****@att.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am writing a unit test for the class that will take a HttpPostedFile in
of
it methods as a parameter. I need to pass this parameter to the method

in the test but I don't see any way to create this file using C#.
I understand that from security point of view it makes sense but I got to write this test unless it's impossible.
Thanks,
Shimon.


Nov 18 '05 #3
Shimon Sim wrote:
I am writing a unit test for the class that will take a
HttpPostedFile in of it methods as a parameter. I need to pass this
parameter to the method in the test but I don't see any way to create
this file using C#.
I understand that from security point of view it makes sense but I
got to write this test unless it's impossible.


I suggest changing the method so it doesn't accept a HttpPostedFile object,
but a Stream instead. This decouples your logic from ASP.NET specific
objects and makes it much easier to test -- not to mention enhanced
resuability.

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #4

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

Similar topics

4
by: Frank Millman | last post by:
Hi all I need to generate potentially large reports from a database, and I want to offer the option of print preview before actually printing (using wxPython). I figure that the best way to...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
10
by: Minh | last post by:
I search in all the Disscussion but can not found. How can I create a MS Access Database file using C# code with a given Table Structure ? For example, I want to create a Access Database File...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
3
by: sanghavi | last post by:
how to create a set up project in vb.net..how to run an application on a different machine
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.