https://github.com/socolin/nsubstitutecomplete
A Rider / Resharper Plugin that provide quick fixes and smart autocomplete when using NSubstitute
https://github.com/socolin/nsubstitutecomplete
Last synced: about 1 month ago
JSON representation
A Rider / Resharper Plugin that provide quick fixes and smart autocomplete when using NSubstitute
- Host: GitHub
- URL: https://github.com/socolin/nsubstitutecomplete
- Owner: Socolin
- License: mit
- Created: 2021-01-05T10:34:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-04-06T05:56:58.000Z (about 2 months ago)
- Last Synced: 2025-04-06T06:27:39.033Z (about 2 months ago)
- Language: C#
- Size: 3.17 MB
- Stars: 26
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# NSubstituteComplete
A Rider / Resharper Plugin that provide quick fixes and smart autocomplete when using [NSubstitute](https://nsubstitute.github.io/)
[](https://plugins.jetbrains.com/plugin/15798-nsubstitutecomplete)
[](https://plugins.jetbrains.com/plugin/15801-nsubstitutecomplete)
## Build plugin
```shell
./gradlew :buildPlugin
```## Functionality
### QuickFix: Fill with mocks

### Mock aliases
This quick fix support the "Mock Aliases" feature. This allows you to define (In the _Unit Testing Settings_ panel) a list of type that should not be mocked with `Substitute.For<>` but with an explicit type instead. This is useful for complex type that required a lot of mocking.
Here an [example](https://github.com/Socolin/NaheulbookBackend/blob/master/Naheulbook.Core.Tests.Unit/TestUtils/FakeUnitOfWorkFactory.cs) of such a type
Example of configuration
```c#
IDep1 => FakeDep1()
IDep2 = FakeDep2()
IDep3 = FakeDep3
IDep4 = FakeDep4
IGenericDep = FakeGenericDep1()
IGenericDep = FakeGenericDep2()
```If the `Fake` class does not match `IDep` it will search into the members of the `Fake` class a matching member.
[](doc/images/MockedAliases.gif)
### Completion: Suggest Arg.Any / Arg.Is

## Notes
This plugin was inspired by [MoqComplete](https://github.com/Abc-Arbitrage/Abc.MoqComplete).
Thanks to all the people on the `#dotnet-pluginwriters` Slack channel for their help !## Other plugins that may interest you
| Plugin |Rider | Resharper |
|-----|-----|------|
| RenameRelatedTests |[](https://plugins.jetbrains.com/plugin/15795-renamerelatedtests)|[](https://plugins.jetbrains.com/plugin/15800-renamerelatedtests)|
| AutocompleteTestStrings |[](https://plugins.jetbrains.com/plugin/15796-autocompleteteststrings)|[](https://plugins.jetbrains.com/plugin/15802-autocompleteteststrings)|