Converting a class library to WPF control library
In Visual Studio 2010, depending on the project type you get different options when you want to add new items to a project. If you have created a class library and later you figure out that you want to add WPF custom controls, you will need to change the project so that it supports this functionality.
Validating UnityContainer configuration
In one of my recent projects I have reached the need to validate that I have all dependencies correctly registered in my UnityContainer. For those that are not familiar with Unity, it is a dependency injection container that allows constructor, property and method call dependency injection.
You can get more information about how Unity works and also download the latest release from Codeplex: http://unity.codeplex.com/
Reusable deferred action execution mechanism
There are situations in which you need to do some processing when an event fires but you don’t want to do it every time if the event happens in a very short time interval. Such a situation can occur for example when handling MouseMove events – you want to do the processing when the mouse stops for a certain amount of time, but not for every intermediate position of the mouse.
A must have for any WPF developer
As a WPF developer, I often find myself trying to debug the visual structure of my applications or to find out why something doesn’t work as expected. The Visual Studio debugger can help up to a certain point, but for runtime visual debugging it lacks the necessary features. Luckily, there is an awesome free tool that you can use for this – Snoop. The tool itself is very straightforward – you select your running application press a button and you can see the whole visual tree:
My list of Visual Studio 2010 Extensions
I find that with the extension support in VS2010, programmers don’t really have an excuse for not using tools to increase their productivity and to increase the overall quality of their work. I am a really lazy programmer, in the sense that I don’t’ like to do repetitive boring tasks. Extensions are one of the solutions to being a happy lazy programmer. The other one is writing quality code, but that’s another story. So here is a list of all Extensions that I use in day-to-day work
Transitioning from MSUnit to NUnit–Part 4:Code coverage
When doing TDD or at least unit testing, it is necessary to know how much of your code is covered by tests and, more importantly, which code isn’t. Since we migrated to NUnit the integrated Visual Studio 2010 code coverage does not do the job anymore for us (although I’ve found several articles on how to enable it, for some reason I couldn’t get it running).
There are two tools that you can use instead – one of them is NCover, which is a great tool but not free. The other one is PartCover, which is a free code coverage tool. I’ve opted to go with the latter. The main problem with PartCover is the almost non-existent documentation. After several hours of trying out different combinations of options I finally got it running and it does it job really good.
Transitioning from MSUnit to NUnit–Part 3:Integration with TFS builds
One of our main requirements when performing the migration was to have the same level of integration with our Team Build system. This means that the build should run all tests and fail if any test fails. Also we should be able to see in the build log which tests have failed.
This step is the most complicated one so here is a quick breakdown of all the steps involved:
- Setting up the build server
- Changing the build template
- Add a new ForEach sequence to iterate through all test assemblies
- Add a sequence to run all tests in a single test assembly
- Invoke NUnit
- Publish NUnit results
- Mark the build as broken if not all tests pass
- Modify the workflow to support projects without a test settings file
- Check in the build template file.
Transitioning from MSUnit to NUnit–Part 2:Migrating test code
Fortunately, this is really a very simple step (or at least in our case it was):
Transitioning from MSUnit to NUnit–Part 1:Tools
Since we are not using MSBuild anymore, we need some tools to help us in the testing process. Below are the tools that I currently use for this:
Transitioning from MSUnit to NUnit
I am working in a large WPF project that is in a continuous evolution. Initially when we started the project we didn’t have any kind of unit testing in mind, then later we switched to an (almost) TDD approach. Since we use TFS for source control and automated builds, the natural decision was to use MSUnit as the test framework. Although this approach has some benefits, after the project has grown in size we have reached several limitations.