private void BindRetryManager(IKernel kernel) { string retryStrategyName = "ExponentialBackoff"; var retryStrategy = kernel.Get <RetryStrategy>(retryStrategyName); var retryStrategies = new List <RetryStrategy>() { kernel.Get <ExponentialBackoff>() }; kernel.Bind <IEnumerable <RetryStrategy> >().ToConstant <List <RetryStrategy> >(retryStrategies).Named("RetryManagerStrategies"); var retryManager = new CustomRetryManager(retryStrategies, retryStrategyName, null); kernel.Bind <CustomRetryManager>().ToConstant(retryManager); RetryManager.SetDefault(retryManager); }
private static void BindRetryManager(MoqMockingKernel kernel) { string retryStrategyName = "ExponentialBackoff"; var retryStrategy = kernel.Get <RetryStrategy>(retryStrategyName); var retryStrategies = new List <RetryStrategy>() { kernel.Get <ExponentialBackoff>() }; kernel.Bind <IEnumerable <RetryStrategy> >().ToConstant <List <RetryStrategy> >(retryStrategies).Named("RetryManagerStrategies"); var retryStrategyNameMap = new Dictionary <string, string>(); retryStrategyNameMap.Add(retryStrategyName, retryStrategyName); var retryManager = new CustomRetryManager(retryStrategies, retryStrategyName, retryStrategyNameMap); kernel.Bind <CustomRetryManager>().ToConstant(retryManager); RetryManager.SetDefault(retryManager); }