Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
AnswerRe: file checker dump log in C# Pin
Maciej Los6-Feb-18 5:25
mveMaciej Los6-Feb-18 5:25 
AnswerRe: file checker dump log in C# Pin
Richard MacCutchan6-Feb-18 5:26
mveRichard MacCutchan6-Feb-18 5:26 
AnswerRe: file checker dump log in C# Pin
Dave Kreskowiak6-Feb-18 16:55
mveDave Kreskowiak6-Feb-18 16:55 
QuestionHow to programmatically paste text into a specific Word document Pin
Leif Simon Goodwin6-Feb-18 4:19
Leif Simon Goodwin6-Feb-18 4:19 
AnswerRe: How to programmatically paste text into a specific Word document Pin
Eddy Vluggen6-Feb-18 5:25
professionalEddy Vluggen6-Feb-18 5:25 
GeneralRe: How to programmatically paste text into a specific Word document Pin
Leif Simon Goodwin6-Feb-18 21:51
Leif Simon Goodwin6-Feb-18 21:51 
GeneralRe: How to programmatically paste text into a specific Word document Pin
Eddy Vluggen7-Feb-18 1:31
professionalEddy Vluggen7-Feb-18 1:31 
GeneralRe: How to programmatically paste text into a specific Word document Pin
Leif Simon Goodwin7-Feb-18 3:46
Leif Simon Goodwin7-Feb-18 3:46 
GeneralRe: How to programmatically paste text into a specific Word document Pin
Eddy Vluggen8-Feb-18 0:29
professionalEddy Vluggen8-Feb-18 0:29 
AnswerRe: How to programmatically paste text into a specific Word document Pin
Maciej Los6-Feb-18 5:28
mveMaciej Los6-Feb-18 5:28 
QuestionShould I unit test private methods? Pin
Hila Berger5-Feb-18 23:39
Hila Berger5-Feb-18 23:39 
AnswerRe: Should I unit test private methods? Pin
Pete O'Hanlon6-Feb-18 0:11
mvePete O'Hanlon6-Feb-18 0:11 
GeneralRe: Should I unit test private methods? Pin
OriginalGriff6-Feb-18 0:53
mveOriginalGriff6-Feb-18 0:53 
GeneralRe: Should I unit test private methods? Pin
Hila Berger7-Feb-18 0:24
Hila Berger7-Feb-18 0:24 
GeneralRe: Should I unit test private methods? Pin
Pete O'Hanlon7-Feb-18 1:05
mvePete O'Hanlon7-Feb-18 1:05 
AnswerRe: Should I unit test private methods? Pin
Eddy Vluggen6-Feb-18 14:43
professionalEddy Vluggen6-Feb-18 14:43 
GeneralRe: Should I unit test private methods? Pin
Hila Berger6-Feb-18 23:58
Hila Berger6-Feb-18 23:58 
AnswerRe: Should I unit test private methods? Pin
GregoryPres7-Feb-18 22:14
GregoryPres7-Feb-18 22:14 
The opinions vary on this subject, so I'll say it depends.

Those who oppose testing private methods, claim that you should only test the public API.
This makes a certain sense, as testing private methods will usually lead to testing implementation, while unit tests should test behavior and if that code needs to be tested then there's a code smell and a design problem. Also by testing public API you indirectly already test the private method - that's also what encapsulation is for.

The private testing proponents claim that you should test as much logic as possible and if there's a reason to test a private method you should.

I believe that good design would usually reduce the need for testing private methods, but there are still some reasons for testing private methods.

Let's not forget that there's also a lot of legacy code that wasn't designed to be testable, so testing private methods would make more sense in order to refactor that code.
Problem with that is how to test private methods, as mocking is usually limited to public and virtual methods unless you use "unlimited" mocking tools.

So you should decide what is the right path for you or your team, just be consistent.
AnswerRe: Should I unit test private methods? Pin
Frygreen22-Feb-18 10:46
Frygreen22-Feb-18 10:46 
QuestionLinq Query Limitations, more than one query fails Pin
Member 136243255-Feb-18 10:47
Member 136243255-Feb-18 10:47 
AnswerRe: Linq Query Limitations, more than one query fails Pin
Dave Kreskowiak5-Feb-18 10:55
mveDave Kreskowiak5-Feb-18 10:55 
GeneralRe: Linq Query Limitations, more than one query fails Pin
Member 136243255-Feb-18 11:09
Member 136243255-Feb-18 11:09 
GeneralRe: Linq Query Limitations, more than one query fails Pin
Member 136243255-Feb-18 11:14
Member 136243255-Feb-18 11:14 
GeneralRe: Linq Query Limitations, more than one query fails Pin
Member 136243255-Feb-18 11:20
Member 136243255-Feb-18 11:20 
QuestionPreferred connection to database, config or class? Pin
bjay tiamsic4-Feb-18 12:46
bjay tiamsic4-Feb-18 12:46 

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.