Click here to Skip to main content
15,913,408 members
Home / Discussions / C#
   

C#

 
QuestionMocking objects Pin
N a v a n e e t h23-May-08 21:53
N a v a n e e t h23-May-08 21:53 
AnswerRe: Mocking objects Pin
Colin Angus Mackay23-May-08 23:22
Colin Angus Mackay23-May-08 23:22 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 7:22
N a v a n e e t h24-May-08 7:22 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 8:49
Colin Angus Mackay24-May-08 8:49 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 9:02
N a v a n e e t h24-May-08 9:02 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 9:31
Colin Angus Mackay24-May-08 9:31 
GeneralRe: Mocking objects Pin
N a v a n e e t h24-May-08 18:13
N a v a n e e t h24-May-08 18:13 
GeneralRe: Mocking objects Pin
Colin Angus Mackay24-May-08 22:57
Colin Angus Mackay24-May-08 22:57 
N a v a n e e t h wrote:
This works pretty well and I can mock IProduct easily. Is this approach correct ?


Okay - but if ProductDTO is immutable. In other words everything is created in the constructor and all the properties are getters and there are no other methods that modified the contents of the class, then you don't need to mock the DTO as there is no functionality to mock. If you are planning to use the DTO to update the database and have the business layer modify it and send it back to the DAL then obviously it cannot be immutable.

N a v a n e e t h wrote:
So in a performance perceptive, will this be an overhead ?


Yes, but generally it is negligible. It is certainly much smaller than with a DataSet.

If you are sure that you will only ever connect to a database then I suppose you could dispense with the DTOs and have the factory class create the business object directly from the IDataReader. In fact, that is something I used to do and it can be quite effective. The factory class is acting as a buffer between the DAL and the Business Layer when you are retrieving data from the database. Out of necessity it knows a little about both layers.


GeneralRe: Mocking objects Pin
N a v a n e e t h25-May-08 7:03
N a v a n e e t h25-May-08 7:03 
GeneralRe: Mocking objects Pin
N a v a n e e t h25-May-08 18:48
N a v a n e e t h25-May-08 18:48 
QuestionFormatting a number Pin
N.Surendra Prasad23-May-08 20:43
N.Surendra Prasad23-May-08 20:43 
GeneralRe: Formatting a number Pin
Krazy Programmer23-May-08 20:45
Krazy Programmer23-May-08 20:45 
AnswerRe: Formatting a number Pin
DaveyM6923-May-08 22:19
professionalDaveyM6923-May-08 22:19 
GeneralRe: Formatting a number Pin
N.Surendra Prasad25-May-08 17:29
N.Surendra Prasad25-May-08 17:29 
GeneralRe: Formatting a number Pin
DaveyM6925-May-08 22:26
professionalDaveyM6925-May-08 22:26 
GeneralRe: Formatting a number Pin
DaveyM6925-May-08 23:02
professionalDaveyM6925-May-08 23:02 
QuestionC# noob needs help with udp & in general Pin
DrWigglechin23-May-08 19:29
DrWigglechin23-May-08 19:29 
AnswerRe: C# noob needs help with udp & in general Pin
leppie24-May-08 8:39
leppie24-May-08 8:39 
QuestionHow to update exe file after install application Pin
cocoonwls23-May-08 16:32
cocoonwls23-May-08 16:32 
AnswerRe: How to update exe file after install application Pin
Ravi Bhavnani23-May-08 16:59
professionalRavi Bhavnani23-May-08 16:59 
GeneralRe: How to update exe file after install application Pin
cocoonwls23-May-08 18:15
cocoonwls23-May-08 18:15 
GeneralRe: How to update exe file after install application Pin
Ravi Bhavnani23-May-08 18:19
professionalRavi Bhavnani23-May-08 18:19 
QuestionAbout "Cell Change" event in Excel Pin
Mushtaque Nizamani23-May-08 16:32
Mushtaque Nizamani23-May-08 16:32 
QuestionWindows file metadata Pin
asgardh23-May-08 15:13
asgardh23-May-08 15:13 
QuestionAbstract Classes and Interfaces Pin
Jacob Dixon23-May-08 13:31
Jacob Dixon23-May-08 13:31 

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.