On Tuesday, May 7, 2019 at 1:57:34 AM UTC-7, Joseph Vaughan wrote: > Does anyone have any good solutions for substituting in the > IServerStreamWriter, IClientStreamWriter, IAsyncStreamReader types, either > under a mock framework or with test stubs?
In my team's code base, we've divorced the business logic from the gRPC handler implementation by using DataFlow [1] blocks. The business logic doesn't even contain a reference to the gRPC assemblies at all. It does use Proto messages. This makes the business logic easily unit testable. We have small adapters from the gRPC interfaces to Dataflow blocks. The service handlers use these adapters to bridge from IServerStreamWriter & friends to the business logic's input/output types. These adapters get tested in our server integration tests. We have four different projects of interest here: * core (class library): business logic * core-tests (unit tests): tests for code in core * service (executable): reads config, starts gRPC service, gRPC to business logic adapter (service handlers), Dataflow blocks adapter * service-tests (integration tests): stands up full service using single-box config and exercises it [1]: https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/dataflow-task-parallel-library -- Christopher Warrington Microsoft Corp. -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/6c54c2e6-47f9-4e4a-8a8d-1aa8e050fc65%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.