public void RegisterAndUnregisterFunctionMetadataShouldWork()
        {
            string path         = Path.Join(_functionDirectory, "testBasicFunction.ps1");
            var    functionInfo = GetAzFunctionInfo(path, string.Empty);

            Assert.Empty(FunctionMetadata.OutputBindingCache);
            _testManager.RegisterFunctionMetadata(functionInfo);
            Assert.Single(FunctionMetadata.OutputBindingCache);
            _testManager.UnregisterFunctionMetadata();
            Assert.Empty(FunctionMetadata.OutputBindingCache);
        }
        /// <summary>
        /// Method to process a InvocationRequest.
        /// InvocationRequest should be processed in parallel eventually.
        /// </summary>
        internal StreamingMessage ProcessInvocationRequest(StreamingMessage request)
        {
            InvocationRequest invocationRequest = request.InvocationRequest;

            StreamingMessage response = NewStreamingMessageTemplate(
                request.RequestId,
                StreamingMessage.ContentOneofCase.InvocationResponse,
                out StatusResult status);

            response.InvocationResponse.InvocationId = invocationRequest.InvocationId;

            // Invoke powershell logic and return hashtable of out binding data
            try
            {
                // Load information about the function
                var functionInfo = _functionLoader.GetFunctionInfo(invocationRequest.FunctionId);
                _powerShellManager.RegisterFunctionMetadata(functionInfo);

                Hashtable results = functionInfo.Type == AzFunctionType.OrchestrationFunction
                    ? InvokeOrchestrationFunction(functionInfo, invocationRequest)
                    : InvokeSingleActivityFunction(functionInfo, invocationRequest);

                BindOutputFromResult(response.InvocationResponse, functionInfo, results);
            }
            catch (Exception e)
            {
                status.Status    = StatusResult.Types.Status.Failure;
                status.Exception = e.ToRpcException();
            }
            finally
            {
                _powerShellManager.UnregisterFunctionMetadata();
            }

            return(response);
        }