Search This Blog

27 August 2010

Productivity Power Tools for Visual Studio

Began using Power Tools just recently and already I'm finding that I depend on this tool more and more. handling large solutions with many files and where people conduct refactoring on a daily basis.

Is much easier to get a good organisation if you are able to overlook what you have changed without having to search all around for changes that have been made. Another good thing with this tool is that its relativitly lightweight.

Last but not least this tool helps you out when files and classes are being written with different styles with regards to tab or spaces for example.

13 August 2010

Cold not load type '...' from assembly '...' during builds on different targets

A hard to track down error occured during my current project that required several hours of work before finally getting solved by a very simple solution so I feel I should give some information about my problem and the solution found to save others from doing the same work.

The problem is that we are using multiple build configurations with substitution files for Test, Development and Production environment.When building for some environment and then switching configuraton and adding some classes, or when other classes are checked in, in some circumstances a problem will occur when different assemblies cannot not be found.

The thing that makes this even harder to figure out is the fact that while using MS Test to run the test the tests will fail but if you enter debug mode the tests will pass without any problems.

The solution is to make a clean of the entire solution not just the current configuration, either by switching between the configurations and cleaning or running a batch build and cleaning all different configurations and cleaning them up and rebuilding.

The reason while this is happening is that some files cannot be deleted for some reason and the build actually fails to rebuild the assemblies needed.

11 August 2010

Mocking of objects

When testing an application that interacts with other external systems or that access a database you need some handling for this to make this work correctly.

Either you need some test versions of the systems and setup the database similar as the production database which is cubersome and lot of work to make each test work. A slight change in the object model would require that the tests also are changed.

A better method is to use some mocking framework to simulate that certain calls are being made and check that this really happens in the test. There exists several such mocking frameworks that have different advantages and disadvantages.

In the projects I'm currently working with we use a mocking framework developed by Mikael Waltersson which is called Simple Mock. This mock framework is as the name specifies very simple to use but don't be fooled the easy of use doesn't imply that the mock framework lacks functionallity, instead it has the functionallity that is required for a mock framework.

Try it, the time you spend learning how to setup the framework for your project will be earn quick enough once you start writing more and more tests.

Link to the development page on codeproject: