O'Reilly logo

AOP in .NET: Practical Aspect-Oriented Programming by Matthew D. Groves, Foreword by Phil Haack

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Unit testing aspects

This chapter covers

  • Writing unit tests with NUnit
  • Testing strategies when using AOP
  • Testing Castle DynamicProxy and PostSharp aspect classes
  • Test code to which aspects are applied
  • Using DI to write testable code (including aspects)

All of the code you write should be tested. If you believe that, then writing automated unit tests should be important to you, because it makes your code much faster and easier to test. In earlier chapters, I mentioned that one of the benefits of using AOP is that it makes testing easier. For code that’s heavily tangled, this should be obvious: small classes that do only one thing are easier to test than big classes that do multiple things.

But for code that’s less tangled, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required