diff --git a/src/ServiceBus/Helpers/CancelScheduledMessagesHelper.cs b/src/ServiceBus/Helpers/CancelScheduledMessagesHelper.cs index 457e3cbe..4de0ab15 100644 --- a/src/ServiceBus/Helpers/CancelScheduledMessagesHelper.cs +++ b/src/ServiceBus/Helpers/CancelScheduledMessagesHelper.cs @@ -45,15 +45,16 @@ public static async Task CancelScheduledMessages(ServiceBusHelper2 serviceBusHel await Task.WhenAll(tasks); stopwatch.Stop(); - Func successesSingleOrPlural = () => successes.Count > 1 ? "messages" : "message"; + Func singleOrPlural = (c) => c > 1 ? "messages" : "message"; - serviceBusHelper.WriteToLog($"Successfully cancelled {successes.Count} scheduled {successesSingleOrPlural()} in {stopwatch.Elapsed}."); + + serviceBusHelper.WriteToLog($"Successfully cancelled {successes.Count} " + + $"scheduled {singleOrPlural(successes.Count)} in {stopwatch.Elapsed}."); if (failures.Count > 0) { - Func failuresSingleOrPlural = () => failures.Count > 1 ? "messages" : "message"; - - serviceBusHelper.WriteToLog($"Failed to cancel {failures.Count} {failuresSingleOrPlural()}."); + serviceBusHelper.WriteToLog($"Failed to cancel {failures.Count} " + + $"{singleOrPlural(failures.Count)}."); } } finally