1

I have a component in Business Library which only work when the request comes from IIS (not even request from Visual Studio running on IIS) so I dont have issues when my web application invokes that component but I wanted to write Unit test for the business Library, So now how do I make my MS Test project behave as web application on IIS.

I can't do exception here because those exception are very specific to the Component and stack trace is not helpful.

Praneeth
  • 2,527
  • 5
  • 30
  • 47
  • Give some more info. Show the stack trace. If not, we can't guess hte exact problem. Perhaps your BRL relies on HttpContext (directly or inderectly) or depends on web.config configuration. This are the most ypical cases. But we can't guess without seeing some extra info. – JotaBe Mar 28 '12 at 21:52
  • Stacktrace is not showing anything about web its all internal methods of that component(Blaze Rules Engine). No webconfig changes are made – Praneeth Mar 28 '12 at 23:03
  • 1
    In many instances the frameworks, need configuration info, which is stored in web.config. When you run unit tests for your library, it can try to find configuration information, and, as web.config is not available, it will fail to run. I've seen many frameworks which shows very strange error messages, instead of informing about the missing configuration. Get sure this is not your case. – JotaBe Mar 29 '12 at 10:24
  • Yaa In most of the cases, yes. But there is no web.config change I made for component and try I looking at all possible web.config entries. No luck. – Praneeth Mar 29 '12 at 11:40
  • If we don't know why that error is happening, we will not be able to inject the neccessay "meat" in the Unit Tests. As a last resort, look for depedencies: http://stackoverflow.com/questions/227886/how-do-i-determine-the-dependencies-of-a-net-application – JotaBe Mar 29 '12 at 13:04

0 Answers0