/// <summary> /// Initializes a new instance of the <see cref="WaitAndRetryWithRandomSleepDurations"/> class. /// </summary> /// <param name="configuration"> /// The configuration object for the instance being created. /// This parameter cannot be <see langword="null"/>. /// </param> /// <param name="randomValueProvider"> /// A service to generate random values. /// This parameter cannot be <see langword="null"/>. /// </param> /// <exception cref="ArgumentNullException"> /// When <paramref name="configuration"/> is <see langword="null"/> /// When <paramref name="randomValueProvider"/> is <see langword="null"/> /// </exception> public WaitAndRetryWithRandomSleepDurations( WaitAndRetryWithRandomSleepDurationsConfiguration configuration, IRandomValueProvider randomValueProvider) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _randomValueProvider = randomValueProvider ?? throw new ArgumentNullException(nameof(randomValueProvider)); }
public async Task <IActionResult> Random([FromServices] IRandomValueProvider random) { var ids = (await this._articleService.AllIds()).ToList(); var randomId = ids[random.Next(0, ids.Count)]; return(await this.Details(randomId)); }