Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2005

Tip: Looking for answers? Try searching our database.

Nunit - testing a web service that relies on web.config

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Backer - 20 Aug 2005 01:05 GMT
I can't quite figure out how to test my ws.  It relies on a web.config
to load connection strings, output directores, etc, and I am trying to
test from within the project itself.  NUnit GUI just loads the dll
(though I am using zanebug ATM.)

I currently do something like this :
[Test]
public function CrashMeBaby() {
   FromUsComesKrashes fun = new FromUsComesKrashes ();
   fun.DoIt(); //-- fireworks
}

It errors because it's not running inside a web process, and web.config
hasn't been loaded, and various properties are of course therefore
inaccessible?

What is the easiest way to get around this?  I am looking at NUnitASP
right now, or possibly loading the required values directly from the
web.config using the wonderfully documented System.Configuration :)

Thanks for any help!

- Andrew
Manohar Kamath - 24 Aug 2005 04:15 GMT
If you download the latest NUnit (www.nunit.org), you can specify the
application configuration file for a given project. Specify web.config, and
you will be able to unit test your code. The only part you can't test easily
is anything that relies on an HTTP context.

Signature

Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com

>I can't quite figure out how to test my ws.  It relies on a web.config
> to load connection strings, output directores, etc, and I am trying to
[quoted text clipped - 19 lines]
>
> - Andrew
Andrew Backer - 28 Aug 2005 21:29 GMT
I didn't know you could do that!  I am just loading the dll in the gui
and not actually making .nunit projects.  I guess that'll have to
change.  Thanks for pointing this out.

-Andrew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.