Click here to Skip to main content
15,887,422 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani18-Feb-24 6:57
professionalRavi Bhavnani18-Feb-24 6:57 
GeneralRe: All high-level classes must depend only on Interfaces Pin
englebart19-Feb-24 6:27
professionalenglebart19-Feb-24 6:27 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani19-Feb-24 9:16
professionalRavi Bhavnani19-Feb-24 9:16 
GeneralRe: All high-level classes must depend only on Interfaces Pin
hpcoder224-Feb-24 21:26
hpcoder224-Feb-24 21:26 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani24-Feb-24 21:48
professionalRavi Bhavnani24-Feb-24 21:48 
GeneralRe: All high-level classes must depend only on Interfaces Pin
hpcoder225-Feb-24 17:37
hpcoder225-Feb-24 17:37 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani25-Feb-24 20:05
professionalRavi Bhavnani25-Feb-24 20:05 
GeneralRe: All high-level classes must depend only on Interfaces Pin
hpcoder226-Feb-24 13:28
hpcoder226-Feb-24 13:28 
Quite easily. Options include:
1. Black box testing - test the assembled class with its dependencies, based on whatever attributes are publicly visible. 90% of the time this is all that is needed.
2. White box testing - test the assembled class with its dependencies, but also declare internal state as protected, and have the test fixture inherit from the class being tested.
3. White box testing - instead of declaring the internal attributes protected, declare an internal class Test and make it friends with the class being tested. The actual implementation of the test class can be deferred to the unit test code.

All of the above I have used in a unit testing environment, and are way simpler to understand, debug and otherwise maintain than dependency injected/mocked code.

The only time mocking is really needed is when it is impractical to instantiate the dependency in the CI environment. Examples might include a full database, or something that depends on network resources.
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani27-Feb-24 4:51
professionalRavi Bhavnani27-Feb-24 4:51 
GeneralRe: All high-level classes must depend only on Interfaces Pin
hpcoder227-Feb-24 10:53
hpcoder227-Feb-24 10:53 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani27-Feb-24 12:24
professionalRavi Bhavnani27-Feb-24 12:24 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell19-Feb-24 6:11
jschell19-Feb-24 6:11 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani19-Feb-24 9:14
professionalRavi Bhavnani19-Feb-24 9:14 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell20-Feb-24 12:11
jschell20-Feb-24 12:11 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani20-Feb-24 17:18
professionalRavi Bhavnani20-Feb-24 17:18 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell22-Feb-24 12:29
jschell22-Feb-24 12:29 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani23-Feb-24 19:00
professionalRavi Bhavnani23-Feb-24 19:00 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell26-Feb-24 12:13
jschell26-Feb-24 12:13 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani27-Feb-24 4:46
professionalRavi Bhavnani27-Feb-24 4:46 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell28-Feb-24 12:15
jschell28-Feb-24 12:15 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani28-Feb-24 17:43
professionalRavi Bhavnani28-Feb-24 17:43 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell29-Feb-24 12:29
jschell29-Feb-24 12:29 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani29-Feb-24 16:07
professionalRavi Bhavnani29-Feb-24 16:07 
GeneralRe: All high-level classes must depend only on Interfaces Pin
jschell1-Mar-24 11:59
jschell1-Mar-24 11:59 
GeneralRe: All high-level classes must depend only on Interfaces Pin
Ravi Bhavnani1-Mar-24 16:35
professionalRavi Bhavnani1-Mar-24 16:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.