public void Command_DynamicOwnerFails() { try { TestHystrixCommand<bool> command = new DynamicOwnerTestCommand(null); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Failure)); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Timeout)); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Success)); Assert.AreEqual(true, command.Execute()); Assert.Fail("we should have thrown an exception as we need an owner"); } catch (Exception) { // success if we get here } Hystrix.Reset(); }
public void Command_DynamicOwner() { try { TestHystrixCommand<bool> command = new DynamicOwnerTestCommand(CommandGroupForUnitTest.OwnerOne); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Failure)); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Timeout)); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Success)); Assert.AreEqual(true, command.Execute()); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Failure)); Assert.AreEqual(0, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Timeout)); Assert.AreEqual(1, command.Builder.Metrics.GetRollingCount(HystrixRollingNumberEvent.Success)); } catch (Exception) { Assert.Fail("We received an exception."); } Hystrix.Reset(); }