Make client functions overridable


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 4:11 AM by lfoust


lfoust wrote May 22, 2010 at 4: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 3:26 AM

Appologies. Here's the patch file.

wrote May 23, 2010 at 3:26 AM

lfoust wrote May 23, 2010 at 4: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 4:11 AM

Resolved with changeset 48562.

wrote Feb 13, 2013 at 5:38 PM

wrote May 15, 2013 at 11:08 PM