/// <summary> /// A utility method to execute modules in serial. The resulting documents will be materialized before returning. /// A new <see cref="TestExecutionContext"/> will be created. /// </summary> /// <param name="document">The initial input document.</param> /// <param name="context">The execution context to use.</param> /// <param name="modules">The modules to execute.</param> /// <returns>A materialized list of result documents from the last module.</returns> public static async Task <ImmutableArray <TestDocument> > ExecuteAsync(TestDocument document, TestExecutionContext context, params IModule[] modules) => (await context.ExecuteModulesAsync(modules, document?.Yield())).Cast <TestDocument>().ToImmutableDocumentArray();
/// <summary> /// A utility method to execute modules in serial. The resulting documents will be materialized before returning. /// A new <see cref="TestExecutionContext"/> will be created. /// </summary> /// <param name="document">The initial input document.</param> /// <param name="modules">The modules to execute.</param> /// <returns>A materialized list of result documents from the last module.</returns> public static Task <ImmutableArray <TestDocument> > ExecuteAsync(TestDocument document, params IModule[] modules) => ExecuteAsync(new TestExecutionContext(ImmutableArray.Create(document)), modules);