error tests expansion
.NET Test / .NET tests (push) Failing after 2m5s

This commit is contained in:
2026-07-12 18:06:53 +04:00
parent 2dbfd781ec
commit e8ae93799e
23 changed files with 1190 additions and 156 deletions
+14 -2
View File
@@ -98,7 +98,7 @@ public static partial class ResultExtensions
case ResultState.Success:
if (hasErrors) goto afterLoop;
break;
default: throw new ResultNotInitializedException(nameof(results));
}
}
@@ -145,7 +145,19 @@ public static partial class ResultExtensions
}
public static async Task<Result<IEnumerable<T>>> Merge<T>(this IEnumerable<Task<Result<T>>> tasks)
{
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
var taskList = tasks.ToList();
var results = new Result<T>[taskList.Count];
for (int i = 0; i < taskList.Count; i++)
{
var task = await Task.WhenAny(taskList);
taskList.Remove(task);
results[i] = task.IsCompletedSuccessfully
? task.Result
: task.Exception!;
}
return results.Merge();
}