source/TestCommon/source/FunctionApp.TestCommon/FunctionAppHost/FunctionAppHostManagerExtensions.cs
/// <summary>
/// Manually trigger a function. Especially usefull for testing timer triggered functions.
/// </summary>
/// <param name="hostManager"></param>
/// <param name="functionName"></param>
/// <returns>The task object representing the asynchronous operation.</returns>
Manually trigger a function. Especially usefull for testing timer triggered functions.
Manually trigger a function . Especially usefull for testing timer triggered functions .
public static Task<HttpResponseMessage> TriggerFunctionAsync(this FunctionAppHostManager hostManager, string functionName)
        {
            if (hostManager is null)
            {
                throw new ArgumentNullException(nameof(hostManager));
            }
            return hostManager.HttpClient.PostAsync(
                new Uri($"/admin/functions/{functionName}", UriKind.Relative),
                new StringContent("{\"input\":\"\"}", Encoding.UTF8, "application/json"));
        }
public static Task < HttpResponseMessage > TriggerFunctionAsync ( this FunctionAppHostManager hostManager , string functionName ) { if ( hostManager is null ) { throw new ArgumentNullException ( nameof ( hostManager ) ) ; } return hostManager . HttpClient . PostAsync ( new Uri ( $" /admin/functions/ { functionName } " , UriKind . Relative ) , new StringContent ( " \" \" \" \" " , Encoding . UTF8 , " " ) ) ; }
Manually trigger a function.
Manually trigger a function .
The task object representing the asynchronous operation.
The task object representing the asynchronous operation .
FunctionAppHostManager
this
functionName
string
None
hostManager
None