Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
QuestionPrint Pin
Kr_Chandan5-Jun-08 4:10
Kr_Chandan5-Jun-08 4:10 
AnswerRe: Print Pin
leppie5-Jun-08 4:50
leppie5-Jun-08 4:50 
AnswerRe: Print Pin
Brady Kelly5-Jun-08 5:38
Brady Kelly5-Jun-08 5:38 
GeneralRe: Print Pin
Kr_Chandan5-Jun-08 19:09
Kr_Chandan5-Jun-08 19:09 
QuestionNMock expectations producing weird results Pin
N a v a n e e t h5-Jun-08 4:09
N a v a n e e t h5-Jun-08 4:09 
AnswerRe: NMock expectations producing weird results Pin
Judah Gabriel Himango5-Jun-08 5:06
sponsorJudah Gabriel Himango5-Jun-08 5:06 
GeneralRe: NMock expectations producing weird results Pin
N a v a n e e t h5-Jun-08 7:04
N a v a n e e t h5-Jun-08 7:04 
GeneralRe: NMock expectations producing weird results Pin
Judah Gabriel Himango5-Jun-08 7:13
sponsorJudah Gabriel Himango5-Jun-08 7:13 
In short, use stubs for canned results. Use mocks for verifying interactions (e.g. setting expectations). With stubs, it looks just like a real object:

// Stub
myStub.Foo = 5; // Now if anything asks for myStub.Foo, it will return 5. No exceptions thrown, ever.
compared to

// Mock
Expect.Call(myMock.Foo).Return(5); // Exception thrown if myStub.Foo is not called exactly 1 time.


See Martin Fowler's Mocks Aren't Stubs[^] article. MSDN had a good article about the difference between strict mocks, dynamic mocks, and stubs some time ago.








Life, family, faith: Give me a visit.

From my latest post: "How differently the psalmist saw it! How blessed -- how truly happy with real joy! -- is the man who delights in the Law of the Lord."

Judah Himango


GeneralRe: NMock expectations producing weird results Pin
N a v a n e e t h5-Jun-08 7:21
N a v a n e e t h5-Jun-08 7:21 
GeneralRe: NMock expectations producing weird results Pin
Judah Gabriel Himango6-Jun-08 6:45
sponsorJudah Gabriel Himango6-Jun-08 6:45 
GeneralRe: NMock expectations producing weird results Pin
N a v a n e e t h6-Jun-08 7:37
N a v a n e e t h6-Jun-08 7:37 
QuestionSuspending a process programmatically, How is that? Pin
LordCover5-Jun-08 3:21
LordCover5-Jun-08 3:21 
QuestionRe: Suspending a process programmatically, How is that? Pin
LordCover5-Jun-08 3:25
LordCover5-Jun-08 3:25 
AnswerRe: Suspending a process programmatically, How is that? Pin
CPallini5-Jun-08 3:29
mveCPallini5-Jun-08 3:29 
GeneralRe: Suspending a process programmatically, How is that? Pin
LordCover5-Jun-08 3:47
LordCover5-Jun-08 3:47 
AnswerRe: Suspending a process programmatically, How is that? Pin
Anthony Mushrow5-Jun-08 3:33
professionalAnthony Mushrow5-Jun-08 3:33 
GeneralRe: Suspending a process programmatically, How is that? Pin
LordCover5-Jun-08 4:50
LordCover5-Jun-08 4:50 
QuestionApplicationSettingBAse Issue Pin
AmithaRaghu5-Jun-08 2:46
AmithaRaghu5-Jun-08 2:46 
QuestionWCF plugin for VS 2005 Pin
priy@5-Jun-08 1:18
priy@5-Jun-08 1:18 
AnswerRe: WCF plugin for VS 2005 Pin
#realJSOP5-Jun-08 2:45
mve#realJSOP5-Jun-08 2:45 
AnswerRe: WCF plugin for VS 2005 Pin
teejayem5-Jun-08 3:22
teejayem5-Jun-08 3:22 
Questiona question about kernel32.dll and user32.dll Pin
Sajjad Izadi5-Jun-08 1:16
Sajjad Izadi5-Jun-08 1:16 
AnswerRe: a question about kernel32.dll and user32.dll Pin
leppie5-Jun-08 1:20
leppie5-Jun-08 1:20 
Question[Message Deleted] Pin
vinay_K5-Jun-08 0:51
vinay_K5-Jun-08 0:51 
AnswerRe: GDI+ in C# Pin
leppie5-Jun-08 1:15
leppie5-Jun-08 1:15 

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.