From ce83604b4cd36105485af97e21754a55524a882b Mon Sep 17 00:00:00 2001 From: martintmk <103487740+martintmk@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:24:56 +0200 Subject: [PATCH] Kill mutant (#1409) --- .../Controller/HedgingExecutionContext.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs b/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs index 2a2ed1454c8..c55641783f3 100644 --- a/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs +++ b/src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs @@ -202,21 +202,9 @@ private void UpdateOriginalContext() return; } - int accepted = 0; - TaskExecution? acceptedExecution = null; + Debug.Assert(Tasks.Count(t => t.IsAccepted) == 1, $"There must be exactly one accepted outcome for hedging. Found {Tasks.Count(t => t.IsAccepted)}."); - foreach (var task in Tasks) - { - if (task.IsAccepted) - { - accepted++; - acceptedExecution = task; - } - } - - Debug.Assert(accepted == 1, $"There must be exactly one accepted outcome for hedging. Found {accepted}."); - - if (acceptedExecution is not null) + if (Tasks.FirstOrDefault(static t => t.IsAccepted) is TaskExecution acceptedExecution) { originalContext.Properties.Replace(acceptedExecution.Properties);