Unit Testing of Aspects

by Gael Fraiteur on 26 Apr 2013

If there’s one topic that is subject to almost religious observance, this is unit testing.

There has been much hesitation in the community about how PostSharp aspects should be tested and how aspects can consume dependencies from a dependency injection container.

Obviously, we have a lot of experience testing aspects. I finally took the time to write down a set of practices that can be used to create efficient tests of aspects. I also show techniques that allow aspects to consume services from a dependency injection container. Last but not least, I publish and document a test framework for aspect build-time logic, especially logic emitting build-time errors and warnings. The framework is derived from the one we are using internally.

More on our online documentation.

Happy PostSharping!

-gael