|Testing and Debugging Aspects|
Aspects should be tested as any piece of code. However, testing techniques for aspects differ from testing techniques for normal class libraries because of a number of reasons:
Aspects instantiation is not user-controlled.
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:
Writing Simple Tests 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 the Aspect describes several ways for aspects to consume dependencies from dependency-injection containers and service locators.
Debugging Run-Time Aspect Logic explains how to debug run-time logic.
Debugging Build-Time Aspect Logic explains how to debug build-time logic.