/// <summary>
 /// Configure behaviour to inject with the monkey policy.
 /// </summary>
 /// <param name="options">The configuration object.</param>
 /// <param name="latency">A delegate representing the latency to inject.</param>
 public static InjectLatencyOptions Latency(this InjectLatencyOptions options, Func <Context, CancellationToken, TimeSpan> latency)
 {
     options.LatencyInternal = latency;
     return(options);
 }
Exemple #2
0
 internal InjectLatencyPolicy(InjectLatencyOptions options)
     : base(options.InjectionRate, options.Enabled)
 {
     _latencyProvider = options.LatencyInternal ?? throw new ArgumentNullException(nameof(options.LatencyInternal));
 }
 /// <summary>
 /// Configure behaviour to inject with the monkey policy.
 /// </summary>
 /// <param name="options">The configuration object.</param>
 /// <param name="latency">The latency to inject.</param>
 public static InjectLatencyOptions Latency(this InjectLatencyOptions options, TimeSpan latency) =>
 Latency(options, (_, __) => latency);