private static int CBObjDelegate(ActuationObject input) { _test++; if (_test > 4) { return(_test); } return(0); }
private static void DependencyTest() { Console.WriteLine("\nAsyncWriter Dependency Test"); AsyncTextWriter tw = new AsyncTextWriter(); ActuationObject act = new ActuationObject(tw); act.Execute(); WaitForKey(); tw.Dispose(); }
private static void TestCircuitBreakerObj() { _test = 0; Console.WriteLine("\nCircuit Breaker Obj Test"); CircuitBreakerObj cb = new CircuitBreakerObj(10, TimeSpan.FromSeconds(1)); cb.BreakerStatusChange += Cb_BreakerStatusChange; ActuationObject obj = new ActuationObject(new AsyncTextWriter()); var result = cb.Execute(obj, CBObjDelegate).Result; Console.WriteLine($"Circuit Break: {result}"); WaitForKey(); }