Click here to Skip to main content
15,900,907 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: CodeDom users, what's your opinion? Pin
honey the codewitch27-Nov-19 0:12
mvahoney the codewitch27-Nov-19 0:12 
GeneralRe: CodeDom users, what's your opinion? Pin
Nelek27-Nov-19 11:26
protectorNelek27-Nov-19 11:26 
GeneralRe: CodeDom users, what's your opinion? Pin
honey the codewitch27-Nov-19 11:28
mvahoney the codewitch27-Nov-19 11:28 
GeneralRe: CodeDom users, what's your opinion? Pin
Nelek27-Nov-19 19:03
protectorNelek27-Nov-19 19:03 
QuestionUnit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
MSBassSinger26-Nov-19 6:05
professionalMSBassSinger26-Nov-19 6:05 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Eddy Vluggen26-Nov-19 6:32
professionalEddy Vluggen26-Nov-19 6:32 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Maximilien26-Nov-19 6:35
Maximilien26-Nov-19 6:35 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Sander Rossel26-Nov-19 9:32
professionalSander Rossel26-Nov-19 9:32 
This is not an either-or situation.
A test that connects to a database is not a unit test by definition because it tests more than a unit.

Unit tests should use mock data.
It's quick, it's easy and you can think of all manner of weird mock data that may be hard to get in or out of a database.
So use unit tests to check whether A + B == C or if the IEmailService.SendMail is called for a (mock) customer who has "InvoiceByEmail" checked (and that it throws if the email address is empty) and that sort of stuff.
If something fails you know either your test or your logic is wrong, but never some third party component.

Use database and service connections for integration tests.
At this point your unit tests should've done their work and you can assume that the code is correct.
If something fails you know there's probably a problem with the connection and you can focus your efforts on finding the problem there.

I once used a library that could mock HTTP requests.
We used it to test whether the correct OData queries would be send to Microsoft Dynamics CRM (including headers and everything).
It's like unit testing your integration Big Grin | :-D

GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Rick York26-Nov-19 10:29
mveRick York26-Nov-19 10:29 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Marc Clifton26-Nov-19 12:11
mvaMarc Clifton26-Nov-19 12:11 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Dan Neely27-Nov-19 3:22
Dan Neely27-Nov-19 3:22 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
GuyThiebaut26-Nov-19 20:47
professionalGuyThiebaut26-Nov-19 20:47 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
RichardS26-Nov-19 21:02
RichardS26-Nov-19 21:02 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Tomas Takac26-Nov-19 21:26
Tomas Takac26-Nov-19 21:26 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Carl_Sharman26-Nov-19 21:41
Carl_Sharman26-Nov-19 21:41 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Stuart Dootson26-Nov-19 22:58
professionalStuart Dootson26-Nov-19 22:58 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
#realJSOP27-Nov-19 1:11
professional#realJSOP27-Nov-19 1:11 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Ed K27-Nov-19 2:31
Ed K27-Nov-19 2:31 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
davecasdf27-Nov-19 4:36
davecasdf27-Nov-19 4:36 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
MSBassSinger27-Nov-19 6:42
professionalMSBassSinger27-Nov-19 6:42 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Bruce Patin27-Nov-19 6:58
Bruce Patin27-Nov-19 6:58 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
MSBassSinger27-Nov-19 7:08
professionalMSBassSinger27-Nov-19 7:08 
GeneralThought of the Day Pin
OriginalGriff26-Nov-19 5:07
mveOriginalGriff26-Nov-19 5:07 
GeneralRe: Thought of the Day Pin
DRHuff26-Nov-19 5:21
DRHuff26-Nov-19 5:21 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer26-Nov-19 5:40
professionalDaniel Pfeffer26-Nov-19 5:40 

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.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   495 votes