Code generation tool, to create C# adapter classes for unit testing?
Posted
by RyBolt
on Stack Overflow
See other posts from Stack Overflow
or by RyBolt
Published on 2010-04-20T13:11:07Z
Indexed on
2010/04/20
13:13 UTC
Read the original article
Hit count: 173
I know I wouldn't need this with Typemock, however, with something like MoQ , I need to use the adapter pattern to enable the creation of mocks via interfaces for code I don't control.
For example, TcpClient is a .NET class, so I use adapter pattern to enable mocking of this object, b/c I need an interface of that class. I then produce interface ITcpClient, that can then be implemented via a TcpClientAdapter class, which is just plain vanilla adapter pattern implementation.
I am looking for a tool to do this automatically (creation of interface and adapter), I would think there is one out there somewhere? (or is everyone just hand coding these)
© Stack Overflow or respective owner