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, ...

Get AOP in .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.