Scanning for Extension Points
On initialization, essentially as soon as a FakeItEasy type is accessed, FakeItEasy uses reflection to look for internal and user-supplied extension points. In most cases, there is no need for users to define any extensions, but they may be used to enhance the power and usability of FakeItEasy.
There are currently three kinds of extension points defined:
- Custom Dummy Creation rules,
- Fake Configurators
- Argument Value Formatters
Please see their individual documentation pages to learn how each of these is used.
The scanning process
On startup, FakeItEasy searches:
* its own assembly,
* assemblies already loaded in the current AppDomain and
* additional assemblies identified by the Bootstrapper's
GetAssemblyFileNamesToScanForExtensions
method1
for classes that implement the various extensions points. Any such classes found are added to a catalogue and used at need.
Note: this does not apply to the Silverlight version of the DLL, which does not load externally-supplied extension points. Under Silverlight, only extensions defined in the FakeItEasy assembly are used.
- In FakeItEasy 1.17.0 or earlier, there was no Bootstrapper, and all DLLs in the current working directory were considered as sources for extension points. This lead to some problems, notably slow startup. If you use an old version of FakeItEasy and have these problems, upgrade now.