unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.46k stars 176 forks source link

Make Internal request handler TestMessageHandler like public #532

Closed nova-zyura closed 2 years ago

nova-zyura commented 2 years ago

Can we make the TestMessageHandler become external so that we can create request to internal without having to use test package, this can be use to create interprocess communication server for use in single machine without having to use network protocols, eg. named pipe

rdeago commented 2 years ago

Hello @nova-zyura, thanks for using EmbedIO!

Using TestMessageHandler for inter-process communication is of course a tempting idea, but it wouldn't be the right solution.

TestMessageHandler's only purpose is to emulate end-to-end testing of EmbedIO modules (minus the network connection part, of course) using simple unit tests. As such, it is far from a proper and complete implementation: it has just what's needed to run unit tests on EmbedIO. Being fundamentally testing code, it needs to remain as simple and straightforward as possible.

On the other hand, some effort went into makign sure that TestMessageHandler could reside in its own DLL and only use public-facing APIs of EmbedIO.dll. Therefore, nothing prevents you from copying it into your application, maybe renaming it to something more appropriate to your use case, and adapting it as you see fit.