1

Closed

Make client functions overridable

description

Besides being useful for extensibility, many mocking frameworks require that functions be overridable.
 
An example from Moq:
 
User fakeUser = new User();
Mock<StackOverflowClient> mockClient = new Mock<StackOverflowClient>();
mockClient.Expect<User>(c => c.GetUser(userId)).Returns(fakeUser);

file attachments

Closed May 23, 2010 at 5:11 AM by lfoust

comments

lfoust wrote May 22, 2010 at 5:35 PM

Thank you for your patch. Can you please submit it as a svn patch file so I can more easily distinguish what is changed from what is not. No need to submit items you have not changed. Thanks!

ithi wrote May 23, 2010 at 4:26 AM

Appologies. Here's the patch file.

lfoust wrote May 23, 2010 at 5:04 AM

Thanks, I'll review the patch tonight. Just curious - besides mocking what are other scenarios you plan on overriding these methods?

wrote May 23, 2010 at 5:11 AM

Resolved with changeset 48562.