[ https://issues.apache.org/jira/browse/THRIFT-5173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17435559#comment-17435559 ]
Eric Bléher commented on THRIFT-5173: ------------------------------------- 15 months later, I see this is still open. I could be however closed since a simple workaround is possible: instead of using the client generated, create a wrapper class that inherits from the generated client and make the method virtuals in this wrapper. Thus, this wrapper can be easily mocked for unit tests. Example: {code:java} // wrapper to only get virtual methods public class ThriftPushClientWrapper : generatedPush.Client { public ThriftPushClientWrapper(TProtocol protocol) : base(protocol) { } public virtual Task<PushEventResult> PushEvent(PushEventData data, CancellationToken cancellationToken) => base.pushEvent(data, cancellationToken); } {code} > Thrift C# (netstd) code generator: make method virtual for mocking > ------------------------------------------------------------------ > > Key: THRIFT-5173 > URL: https://issues.apache.org/jira/browse/THRIFT-5173 > Project: Thrift > Issue Type: Improvement > Components: netstd - Compiler > Affects Versions: 0.13.0 > Reporter: Eric Bléher > Priority: Major > > Thrift compiler generates C# clients where methods cannot be mocked because > they are not defined as virtual. > Adding virtual allow the usage of Moq and thus I can have proper unit tests > of my own class implementations consuming theses generated clients. -- This message was sent by Atlassian Jira (v8.3.4#803005)