3proxy | 3proxy - tiny free proxy server | Proxy library
kandi X-RAY | 3proxy Summary
kandi X-RAY | 3proxy Summary
3proxy - tiny free proxy server
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 3proxy
3proxy Key Features
3proxy Examples and Code Snippets
Community Discussions
Trending Discussions on 3proxy
QUESTION
My problem:
I want to unittest a controller. This controller has a constructor that includes a repository. Repositories are named like SomethingRepository
. SomethingRepository
inherits from abstract class BaseRepository
. BaseRepository
inherits from interface IRepository
.
When I want to mock SomethingRepository
using Moq, I will need to mock the interface, as far as I understand, since mocking a class will demand an empty constructor which SomethingRepository
and BaseRepository
don't have. (I don't want to add one)
So, I have tried
...ANSWER
Answered 2021-Oct-04 at 10:27Every SomeRepository
is a IRepository
, but not every IRepository
is a SomeRepository
. If your controller injects a SomeRepository
, you have to provide something which is (or inherits from) the SomeRepository
class.
The solution is to change your controller so that it injects a IRepository
instead.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 3proxy
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