December 2007 Archives

NUnit Ignores App.Config

December 31, 2007

Problem: You want to run NUnit tests in a class library (dll). These test rely on an application configuration file (app.config) for some settings, i.e. custom appSettings or database connection strings. The code compiles and runs fine by itself, but your unit tests always fail. Attaching the Visual Studio debugger to NUnit and stepping through the code, you see that the config seems to be ignored.

Solution: This is a perfectly reasonable thing to do, and it works fine. That is, it works if your "project" in NUnit consists of the assembly, not the Visual Studio Project. If you setup the NUnit project by clicking on Project > Add VS Project, then for some reason the configuration file will be ignored. If, however, you simply drag your assembly file into NUnit, then it should work as expected.

Reusing Code in SSIS

December 13, 2007

Problem: you have an SSIS package that you want to reuse, as a template, in a number of new packages.

Solution: follow Microsoft's simple instructions.

Threading and Waiting with Delegates

December 7, 2007

One of the casualties of not having a full computer science education is that I was barely exposed to threading. In my two Java classes we touched upon it, and wrote some basic examples in the second semester, but that could hardly be called extensive use. Thus, a number of years on, it has been a bit of a struggle for me to use threads in a practical manner. Further complicating the matter is that I've wanted to use anonymous methods (aka delegates) and generally want to do some work after all threads have finished executing.

Your Default Database Is Offline - How Do You Login?

December 6, 2007

Problem: without thinking about the ramifications, you've taken your default database in SQL Server offline. When you try to login through SQL Server Management Studio (or Query Analyzer) you get an error message because the app couldn't switch to the default database. Obviously, one feels pretty dumb after doing this. Thankfully it happened to me in development, not production!

Solution: It turns out the solution is just as easy as the mistake: when you log in, click the options button and choose a different database. More detail at public class:ben harrell.

About this Archive

This page is an archive of entries from December 2007 listed from newest to oldest.

November 2007 is the previous archive.

January 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.12