Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Jun 8, 2023
1 parent 659693e commit d43f755
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Polly.Core.Tests.Hedging;
public class HedgingStrategyOptionsTResultTests
{
[Fact]
public void Ctor_EnsureDefaults()
public async Task Ctor_EnsureDefaults()
{
var options = new HedgingStrategyOptions<int>();

Expand All @@ -17,6 +17,10 @@ public void Ctor_EnsureDefaults()
options.HedgingDelay.Should().Be(TimeSpan.FromSeconds(2));
options.MaxHedgedAttempts.Should().Be(2);
options.OnHedging.Should().BeNull();

var action = options.HedgingActionGenerator(new HedgingActionGeneratorArguments<int>(ResilienceContext.Get(), 1, c => 99.AsOutcomeAsync()))!;
action.Should().NotBeNull();
(await action()).Result.Should().Be(99);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ namespace Polly.Hedging;
/// <param name="Context">The context associated with the execution of a user-provided callback.</param>
/// <param name="Attempt">The zero-based hedging attempt number.</param>
/// <param name="Callback">The callback passed to hedging strategy.</param>
///
public readonly record struct HedgingActionGeneratorArguments<TResult>(ResilienceContext Context, int Attempt, Func<ResilienceContext, ValueTask<Outcome<TResult>>> Callback);

0 comments on commit d43f755

Please sign in to comment.