MiniMock

Minimalistic approach to mocking in .NET

View on GitHub

Decision on Supporting Indexers

Context

In the MiniMock framework, there is a need to determine the scope of support for mocking indexers. Indexers allow objects to be indexed in a similar way to arrays, and supporting them is essential for a comprehensive mocking framework.

Decision

The MiniMock framework will support mocking indexers. This includes both read-only and read-write indexers, ensuring that the framework can handle a wide range of scenarios.

Indexers must be mockable using the following parameters:

if none of the above parameters are provided, accessing the indexer must throw a InvalidOperationException with a message in the form “The indexer for ‘[indexer type]’ in ‘[mocked class]’ is not explicitly mocked.”.

Consequences

Positive:

Negative:


More ADRs can be found in the docs/ADR directory.