Click here to Skip to main content
15,912,932 members
Home / Discussions / C#
   

C#

 
AnswerRe: Application.Exit();, Environment.Exit(0); or this.Close(); Pin
PIEBALDconsult24-May-08 3:35
mvePIEBALDconsult24-May-08 3:35 
GeneralRe: Application.Exit();, Environment.Exit(0); or this.Close(); Pin
Vandretta24-May-08 16:05
Vandretta24-May-08 16:05 
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 
N a v a n e e t h wrote:
Business layer don't know anything about database and my DAL returns a IDataReader


Ah... So it knows it is a database. To me a DAL (Data Abstraction Layer) does exactly that. It abstracts out ANY form of data whether that is a database, XML file, plain text file, web service or whatever.


N a v a n e e t h wrote:
So I should write a mock object which returns IDataReader instance for testing business layer right ?


You can do. However, I've found that mocking things like data readers, stream readers/writers and the like get into quite a bit of problems because of the complexity of the object and the way it interacts with the code you are testing.

I only return IDataReaders in simple cases. I normally try and create some sort of DTO (Data Transfer Object) which is a simple class with just a bunch of properties (very easily mocked). One DTO per row. If the DTO is immutable then better still because then you don't have to mock DTOs you can create real ones (there is generally nothing to be mocked in an immutable object because it cannot change once created).


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 
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 

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.