Click here to Skip to main content
15,887,477 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Post-hoc unit testing, and increasing the unit test coverage rate? Pin
Roger Alsing8-Jun-08 22:34
Roger Alsing8-Jun-08 22:34 
QuestionArchitecture vs TDD Pin
Nathan Gloyn5-Jun-08 9:58
Nathan Gloyn5-Jun-08 9:58 
GeneralRe: Architecture vs TDD Pin
stavinski6-Jun-08 10:37
stavinski6-Jun-08 10:37 
GeneralRe: Architecture vs TDD Pin
Nathan Gloyn8-Jun-08 8:54
Nathan Gloyn8-Jun-08 8:54 
GeneralRe: Architecture vs TDD Pin
Pete O'Hanlon8-Jun-08 8:58
mvePete O'Hanlon8-Jun-08 8:58 
GeneralRe: Architecture vs TDD Pin
Nathan Gloyn8-Jun-08 9:33
Nathan Gloyn8-Jun-08 9:33 
GeneralRe: Architecture vs TDD Pin
Pete O'Hanlon8-Jun-08 10:16
mvePete O'Hanlon8-Jun-08 10:16 
AnswerRe: Architecture vs TDD Pin
Roger Alsing8-Jun-08 22:22
Roger Alsing8-Jun-08 22:22 
Lowest of the Low wrote:
or I have to mark the methods and properties of the base class as virtual and cause a performance problem.


What kind of application are you building?
I'm willing to bet money that you will not notice any difference at all if you go virtual unless you are building some extremely processor intensive algorithm stuff.

Anyway, there are other mock frameworks that allow you to do what you want.
(eg, Typemock , but that one is commercial)

There are also two kinds of mock usage:

1) You use the mock as a stub just to return test data for you.
Eg, you want your DAL class to return some dummy list of customers to your business layer.

2) You do interaction tests, you want to see that classes communicate correctly.
Eg, you might want to test that a business class calls your logger class under certain conditions.
(http://martinfowler.com/articles/mocksArentStubs.html)

The first case is is easy to do with mockframeworks that requires virtual or interfaces.
Since if you need a stub you need to create some sort of interface anyway..
So in this aspect Pete is completely right.

In the 2nd case, you want to make sure that a certain call flow occurss under a certain condition.
In this case you do need to have actual code that interacts, and the mock framework should simply ensure that certain methods were or were not called.
This can also be done with virtual/iface mocks, but they are not always enough, eg, they can not ensure that a static method was called.
So in this aspect you are better off using a mock framework that can intercept any type of call.

(One could argue that static methods are ugly and you should design your api so that you do not need to test if a static/private/non virtual method was called, but that is a whole different story Smile | :) )


GeneralRe: Architecture vs TDD Pin
Nathan Gloyn9-Jun-08 0:37
Nathan Gloyn9-Jun-08 0:37 
GeneralRe: Architecture vs TDD [modified] Pin
Roger Alsing9-Jun-08 1:46
Roger Alsing9-Jun-08 1:46 
Questionmember function or not? Pin
followait1-Jun-08 22:38
followait1-Jun-08 22:38 
AnswerRe: member function or not? Pin
Cedric Moonen4-Jun-08 22:34
Cedric Moonen4-Jun-08 22:34 
GeneralRe: member function or not? Pin
followait5-Jun-08 18:49
followait5-Jun-08 18:49 
GeneralRe: member function or not? Pin
Cedric Moonen5-Jun-08 20:02
Cedric Moonen5-Jun-08 20:02 
GeneralRe: member function or not? Pin
followait6-Jun-08 3:31
followait6-Jun-08 3:31 
GeneralRe: member function or not? Pin
Cedric Moonen6-Jun-08 4:23
Cedric Moonen6-Jun-08 4:23 
GeneralRe: member function or not? Pin
Member 276708410-Jun-08 3:34
Member 276708410-Jun-08 3:34 
QuestionAuto Complete Extender Pin
wantToLearn1-Jun-08 13:56
wantToLearn1-Jun-08 13:56 
AnswerRe: Auto Complete Extender Pin
Pete O'Hanlon1-Jun-08 21:56
mvePete O'Hanlon1-Jun-08 21:56 
QuestionManaging of Tab order in a Smart client application Pin
bluemoon200829-May-08 20:10
bluemoon200829-May-08 20:10 
AnswerRe: Managing of Tab order in a Smart client application Pin
led mike30-May-08 4:24
led mike30-May-08 4:24 
Questionbusiness use case Pin
mehrdadc4827-May-08 8:03
mehrdadc4827-May-08 8:03 
AnswerRe: business use case Pin
led mike27-May-08 8:30
led mike27-May-08 8:30 
GeneralRe: business use case Pin
Member 276708410-Jun-08 3:51
Member 276708410-Jun-08 3:51 
QuestionASP.NET Authentication and Scalability [modified] Pin
Waleed Eissa21-May-08 21:46
Waleed Eissa21-May-08 21: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.