NSubstitute.Analyzers | Roslyn analysers for NSubstitute
kandi X-RAY | NSubstitute.Analyzers Summary
kandi X-RAY | NSubstitute.Analyzers Summary
Analyzers to detect possible NSubstitute usage problems, such as attempts to setup non-virtual members.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of NSubstitute.Analyzers
NSubstitute.Analyzers Key Features
NSubstitute.Analyzers Examples and Code Snippets
Community Discussions
Trending Discussions on NSubstitute.Analyzers
QUESTION
I have a test method:
...ANSWER
Answered 2018-Nov-05 at 23:38Update after comments and question update:
If there are still problems after making the changes from my original answer it may be another test in the fixture that is causing a problem. I recommend adding NSubstitute.Analyzers to the project which can pick up potential issues with NSubstitute usage at compile time using Roslyn. (I recommend adding this to all projects using NSubstitute; it can really help avoid a lot of potential problems!)
If NSubstitute.Analyzers does not find the error then unfortunately we're just left with some manual steps as described in this answer.
Original answer:
Argument matchers need to be used in conjunction with specifying a call or asserting a call was received.
The test you've posted has two places that could be causing this problem:
- As @Fabio mentioned in a comment, an argument matcher is used in
mockService.ServiceMethod()
without a corresponding.Returns
. - An argument matcher is used for a real call to
anotherService.Backup()
Try amending the test like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install NSubstitute.Analyzers
NSubstitute.Analyzers.VisualBasic
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page