Skip to content

Commit eaac467

Browse files
committed
Cleaning up documentation
1 parent b4e10ac commit eaac467

17 files changed

+162
-116
lines changed

docs/ADR/README.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Architecture Decision Records (ADRs) are documents that capture important archit
44

55
All the ADRs have been approved and are considered final decisions for the project.
66

7-
## General ADRs
7+
## General ADRs [TL;DR](general/TLDR.md)
88

99
- [Do We __Really__ Need a New Mocking Framework?](general/DoWeNeedANewMockingFramework.md) - Deciding whether to build a new mocking framework.
1010
- [Matching Target API in Mock API](general/MatchingTargetApi.md) - Ensures the mock API closely mirrors the target API.
@@ -13,27 +13,16 @@ All the ADRs have been approved and are considered final decisions for the proje
1313
- [No Dependencies to Shared Libraries](general/NoDependencies.md) - Avoid dependencies on shared libraries.
1414
- [Documentation and Examples](general/DocumentationAndExamples.md) - Approach to documentation and examples for the framework.
1515
- [Logging and Debugging](general/LoggingAndDebugging.md) - Approach to logging and debugging within the framework.
16-
- [Creating Mocks](general/CreatingMocks.md) - Decision on how to create mocks in the framework.
1716

18-
## Feature Specific ADRs
17+
## Feature Specific ADRs [TL;DR](feature/TLDR.md)
1918

20-
- [Support for Classes and Interfaces](feature/SupportForClassesAndInterfaces.md) - Decision on supporting classes and interfaces in the mocking framework.
19+
- [Support for Classes and Interfaces](feature/SupportForClassesAndInterfaces.md) - How should classes and interfaces be supported.
2120
- [Support for Constructors](feature/SupportForConstructors.md) - Decision on supporting constructors in the mocking framework.
21+
- [Creating Mocks](feature/CreatingMocks.md) - Decision on how to create mocks in the framework.
2222
- [Support for Methods](feature/SupportForMethods.md) - Decision on supporting methods in the mocking framework.
2323
- [Support for Properties](feature/SupportForProperties.md) - Decision on supporting properties in the mocking framework.
2424
- [Support for Events](feature/SupportForEvents.md) - Decision on supporting events in the mocking framework.
2525
- [Support for Indexers](feature/SupportForIndexers.md) - Decision on supporting indexers in the mocking framework.
26-
- Special cases
27-
- [Allowing Skipping Arguments in Mock Setup](feature/SupportSkippingArguments.md) - Allows skipping arguments in mock setups for flexibility.
28-
- [Support for Protected Methods](feature/SupportingProtectedMethods.md) - Decision on whether to support mocking protected methods.
29-
- [Support for Generic Methods (WIP)](feature/SupportForGenericMethods.md) - Decision on supporting generic methods in the mocking framework.
30-
- [Support for Asynchronous Methods (WIP)](feature/SupportForAsynchronousMethods.md) - Handling asynchronous methods in the mocking framework.
31-
- [Support for Virtual Methods (WIP)](feature/SupportForVirtualMethods.md) - Decision on supporting virtual methods in the mocking framework.
32-
- [Support for Overloads (WIP)](feature/SupportForOverloads.md) - Decision on supporting method overloads in the mocking framework.
33-
- [Support for Out and Ref Parameters (WIP)](feature/SupportForOutAndRefParameters.md) - Decision on supporting out and ref parameters in the mocking framework.
34-
- [Support for Internal Methods (WIP)](feature/SupportForInternalMethods.md) - Decision on supporting internal methods in the mocking framework.
35-
- [Support for Abstract Classes (WIP)](feature/SupportForAbstractClasses.md) - Decision on supporting abstract classes in the mocking framework.
36-
- [Support for Delegates (WIP)](feature/SupportForDelegates.md) - Decision on supporting delegates in the mocking framework.
3726

3827
## Unsupported Features
3928

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ In the MiniMock framework, there is a need to establish a standardized approach
77
## Decision
88

99
Mocks will be created using a mock factory. The mock factory will provide a centralized and consistent way to create and configure mocks, ensuring that all mocks are created following the same process and standards.
10+
The constructors of the mock object will remain accessible but should only be used for limited purposes.
1011

1112
## Consequences
1213

docs/ADR/feature/SupportForAbstractClasses.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/ADR/feature/SupportForAsynchronousMethods.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/ADR/feature/SupportForConstructors.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,33 @@
22

33
## Context
44

5-
In the MiniMock framework, there is a need to determine the scope of support for mocking constructors. Initially, the framework will support only classes with parameterless constructors.
6-
This decision simplifies the initial implementation and allows for a gradual introduction of more complex constructor support.
5+
In the MiniMock framework, there is a need to determine the scope of support for mocking constructors.
76

87
## Decision
98

10-
The MiniMock framework will initially support mocking only classes with parameterless constructors.
11-
A plan for adding support for classes with parameterized constructors is being developed and will be implemented in future iterations.
9+
All constructors with the supported access level should be accessible. If no constructor exists, a parameterless constructor is created.
10+
A factory for each option should be created.
1211

13-
Since the main focus of the framework is to provide a simple and easy-to-use mocking solution for interfaces and classes,
14-
the decision to start with parameterless constructors aligns with this goal. See ADR [Support For Classes and Interfaces](SupportForClassesAndInterfaces.md) for more information.
12+
If only internal or private constructors exist, the class is not generated and a warning is registered.
13+
14+
Additionally, the framework should support the following:
15+
16+
- **Parameterized Constructors**: Allow mocking of constructors with parameters, providing flexibility for more complex scenarios.
17+
- **Constructor Overloads**: Support multiple constructors with different parameter lists.
18+
- **Dependency Injection**: Enable mocking of constructors that use dependency injection, ensuring compatibility with modern design patterns.
1519

1620
## Consequences
1721

1822
### Positive:
1923

2024
- **Simplicity**: Simplifies the initial implementation by focusing on parameterless constructors.
21-
- **Incremental Development**: Allows for a phased approach to adding more complex constructor support.
22-
- **Usability**: Provides immediate value by supporting a common use case.
25+
- **Flexibility**: Supporting parameterized constructors and overloads provides more flexibility for developers.
26+
- **Compatibility**: Ensures compatibility with dependency injection, making the framework more versatile.
2327

2428
### Negative:
2529

26-
- **Limited Scope**: Initial support is limited to classes with parameterless constructors, which may not cover all use cases.
27-
- **Future Work**: Additional effort will be required to implement support for parameterized constructors.
30+
- **Complexity**: Adding support for parameterized constructors and overloads increases the complexity of the framework.
31+
- **Maintenance**: Requires ongoing maintenance to ensure that constructor mocking remains robust and up-to-date.
2832

2933
---
3034

docs/ADR/feature/SupportForGenericMethods.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/ADR/feature/SupportForInternalMethods.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/ADR/feature/SupportForMethods.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
## Context
44

5-
In the MiniMock framework, there is a need to determine the scope of support for mocking methods. Supporting all standard ways of creating methods is essential to ensure the framework's flexibility and usability. However, there are currently issues with supporting methods that return `ref` values, which need to be addressed.
5+
In the MiniMock framework, there is a need to determine the scope of support for mocking methods. Supporting all standard ways of creating methods is essential to ensure the framework's
6+
flexibility and usability.
7+
8+
The following type of methods must be supported
9+
- __Asynchronous__ with Task<>, Task, CancellationToken
10+
- __Overloaded__ methods in a way that keeps the required effort to setup the mock to a minimum.
11+
- __Generic__ Including the 'where' __constraints__.
12+
- __Out__ and __ref__ attributes on the method parameters.
613

714
## Decision
815

@@ -18,7 +25,20 @@ Methods must be mockable using the following parameters
1825

1926
if none of the above parameters are provided, calling the method must throw a InvalidOperationException with a message in the form "The method '__[method name]__' in '__[mocked class]__' is not explicitly mocked.".
2027

21-
Special cases like [Overloads], [Generic Methods] and [Async Methods] have dedicated ADRs.
28+
__Asynchronous__ methods are supported. Helper methods are provided to simplify the testing of asynchronous methods. Overloads of the following helper methods are added
29+
30+
- Return : Allows for returning either a Task object or the object to be wrapped in the task object.
31+
- ReturnValues : Allows for returning either a sequence of Task objects or a sequence of objects to be wrapped in task objects.
32+
- () : Methods returning Task can also use the empty delegate.
33+
34+
__Overloaded__ methods can either be mocked explicitly by using `Call` or collectively using the following
35+
36+
- Throw : An exception to be thrown when calling any of the overwritten methods.
37+
- Return : A value to be returned when a method with that return type is called.
38+
- ReturnValues : A sequence of values to be returned when a method with those return types is called multiple times.
39+
- () : Methods returning `void` or `Task` can be mocked using an empty delegate.
40+
41+
Generic methods are supported. The generic type is passed as a type parameter to the 'call' labmda method.
2242

2343
## Consequences
2444

docs/ADR/feature/SupportForOutAndRefParameters.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/ADR/feature/SupportForOverloads.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)