/NSubstituteComplete

A Rider / Resharper Plugin that provide quick fixes and smart autocomplete when using NSubstitute

Primary LanguageC#MIT LicenseMIT

NSubstituteComplete

A Rider / Resharper Plugin that provide quick fixes and smart autocomplete when using NSubstitute JetBrains Plugins JetBrains ReSharper plugins Version GitHub

Build plugin

./gradlew :buildPlugin

Functionality

QuickFix: Fill with mocks

Fill with mocks example

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 of such a type

Example of configuration

IDep1 => FakeDep1()
IDep2<T> = FakeDep2()
IDep3<T> = FakeDep3<T>
IDep4 = FakeDep4<T>
IGenericDep<IDep1> = FakeGenericDep1()
IGenericDep<IDep2> = FakeGenericDep2()

If the Fake class does not match IDep it will search into the members of the Fake class a matching member.

Mock Aliases example

Completion: Suggest Arg.Any / Arg.Is

Completion Arg.Any

Notes

This plugin was inspired by 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 RenameRelatedTestsRirder RenameRelatedTestsResharper
AutocompleteTestStrings AutocompleteTestStringsRider AutocompleteTestStringsRider