Aspects should be tested like any piece of code. However, testing techniques for aspects differ from testing techniques for normal class libraries for several reasons:
Aspect instantiation is not controlled by the user.
Aspects partially execute at build time.
Aspects can emit build errors. Logic that emits build errors should be tested too.
These characteristics are no obstacle to proper testing of aspects.
This chapter contains the following sections:
Testing Run-Time Logic explains how to test the behavior of an aspect.
Testing that an Aspect has been Applied shows how to test that an aspect has been applied to the expected set of code artifacts.
Consuming Dependencies from an Aspect describes several ways for aspects to consume dependencies from dependency-injection containers and service locators.
Debugging Run-Time Logic explains how to debug run-time logic.
Debugging Build-Time Logic explains how to debug build-time logic.