Debugging and End-of-Day Syndrome

What is it about that last thing you want to get done before leaving that just refuses to make sense & work? You come in the next morning and it winds up taking 10 minutes.

That was the case for me today while trying to reconcile LINQ and a Unit Test. For some reason the code works perfectly in the web app, yet refuses to work (or even give an exception) when seated properly in a test fixture. Hopefully I'll update this post tomorrow stating it was something obvious.

Update: Sure enough, it was. I realized that data contexts were being cached in HttpContext, which won't work in libraries where unit tests are being run (they're not part of a web app after all!). A little Thread Local Storage, and my woes are no more.

Posted on 10/13/2008 7:44:00 PM by Jason Nadal

Permalink | Comments |

Categories: development | unitTesting

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5