Some starter code for Chaos Testing .Net Microservices. The best way to get started is to just copy the classes into your own code and tweak them as needed.
The code sample complies with NetStandard 1.4, so it should run in just about any project.
This is a DelegatingHandler you can use with HttpClient or server-side to introduce failures either when calling another HTTP service (HttpClient) or at your own service boundary.
var client = new HttpClient(new ChaosDelegatingHandler() { InnerHandler = new HttpClientHandler()});
config.MessageHandlers.Add(new ChaosDelegatingHandler());
A simple static config class to enable/disable the handler. The default is false.
ChaosConfig.EnableChaos = true;