herodb | Database engine which is either RDBMS or GraphDB | SQL Database library
kandi X-RAY | herodb Summary
kandi X-RAY | herodb Summary
This project is currently under development, it will support two kinds of databases (not on the same instance): RDBMS and GraphDB. The kernel of this database will be merged into in the future, maybe. Hero = H + ero (haha.
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 herodb
herodb Key Features
herodb Examples and Code Snippets
Community Discussions
Trending Discussions on herodb
QUESTION
Here is my controller method
...ANSWER
Answered 2020-Sep-28 at 11:44First of all let's set the basis first: unit testing is different than integration testing.
In that case this is a unit test on the controller's method ContactStatusList
. You're testing only this method and you actually did things correctly by trying to mock your HeroDb
object. Note that you decided to mock this object because this is a dependency.
The problem is you set up the Mock but you don't use it because in your ContactStatusList
method you call new DBClass.HeroDb()
.
There's a 2nd problem is that you're trying to mock a class. This is actually possible but all the class's methods you want to mock must be declared as virtual. Therefore it's actually better to mock an interface instead.
This interface should be received in the constructor of your ListController
. On a regular execution of your Web Project inject an instance of that interface in the startup but in unit tests feed your mock to the ListController
's constructor.
Remember this rule: Any dependency should be received by your controller's constructor
Here is your interface and your DbHero class
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install herodb
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