Skip to content

Commit

Permalink
kill mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Jul 26, 2023
1 parent 7b7bf8f commit 940a005
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static ResilienceStrategyBuilder<TResult> AddHedging<TResult>(this Resili
Guard.NotNull(builder);
Guard.NotNull(options);

builder.AddHedgingCore<TResult, HedgingStrategyOptions<TResult>>(options, isGeneric: true);
builder.AddHedgingCore<TResult, HedgingStrategyOptions<TResult>>(options);
return builder;
}

Expand All @@ -41,7 +41,7 @@ internal static ResilienceStrategyBuilder AddHedging(this ResilienceStrategyBuil
Guard.NotNull(builder);
Guard.NotNull(options);

builder.AddHedgingCore<object, HedgingStrategyOptions>(options, isGeneric: false);
builder.AddHedgingCore<object, HedgingStrategyOptions>(options);
return builder;
}

Expand All @@ -51,15 +51,14 @@ internal static ResilienceStrategyBuilder AddHedging(this ResilienceStrategyBuil
Justification = "All options members preserved.")]
internal static void AddHedgingCore<TResult, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(
this ResilienceStrategyBuilderBase builder,
HedgingStrategyOptions<TResult> options,
bool isGeneric)
HedgingStrategyOptions<TResult> options)
{
builder.AddStrategy(context =>
{
var handler = new HedgingHandler<TResult>(
options.ShouldHandle!,
options.HedgingActionGenerator,
isGeneric);
IsGeneric: builder is not ResilienceStrategyBuilder);
return new HedgingResilienceStrategy<TResult>(
options.HedgingDelay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public class HedgingResilienceStrategyBuilderExtensionsTests
public void AddHedging_Ok()
{
_builder.AddHedging(new HedgingStrategyOptions { ShouldHandle = _ => PredicateResult.True });
_builder.Build().Should().BeOfType<HedgingResilienceStrategy<object>>();
var strategy = _builder.Build().Should().BeOfType<HedgingResilienceStrategy<object>>()
.Subject
.HedgingHandler.IsGeneric.Should().BeFalse();
}

[Fact]
Expand All @@ -23,7 +25,9 @@ public void AddHedging_Generic_Ok()
HedgingActionGenerator = args => () => Outcome.FromResultAsTask("dummy"),
ShouldHandle = _ => PredicateResult.True
});
_genericBuilder.Build().Strategy.Should().BeOfType<HedgingResilienceStrategy<string>>();
_genericBuilder.Build().Strategy
.Should().BeOfType<HedgingResilienceStrategy<string>>()
.Subject.HedgingHandler.IsGeneric.Should().BeTrue();
}

[Fact]
Expand Down

0 comments on commit 940a005

Please sign in to comment.