In A Web App?

  • Thread starter Thread starter bradwiseathome
  • Start date Start date
B

bradwiseathome

I have a DLL that is sometimes used in a ASP.NET 2.0 web app, sometimes
it is used by a console app (unit test). How can I determine if the
current instance (it's not a static class) is definitely running inside
ASP.NET?
 
Why? Does it work completely differently in the unit test class than in the
web application? If so, why? Because you want to focus on the unit only?
Okay, are you using mock objects and injecting them? If not, why not?

The point I am getting to is there is no reason a class should operate
differently under test than live, except perhaps having mocks for
dependencies to avoid actually calling a database, fvor example.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Try this:


if ( null == System.Web.HttpContext.Current )
//Non Web Environment
{

}
else
{

}
 
I have a custom configuration file that the class opens, and it is
relative to the place where the assembly/type/class loaded. If I'm in
an ASP.NET app, I need to know where it is vs a console app (in a unit
test) where it'll be likely somewhere else.

Thanks.
 
Back
Top