public void InvocationRunsToCompletionIfNotStopped()
        {
            var invocationAsyncResult = CreateInvocationResult(completed: true);

            ExpectBeginInvoke(invocationAsyncResult);

            _orchestrationInvoker.Invoke(_orchestrationBindingInfo, _mockPowerShellServices.Object);

            _mockPowerShellServices.Verify(_ => _.BeginInvoke(It.IsAny <PSDataCollection <object> >()), Times.Once);
            _mockPowerShellServices.Verify(_ => _.EndInvoke(invocationAsyncResult), Times.Once);
            _mockPowerShellServices.Verify(_ => _.ClearStreamsAndCommands(), Times.Once);
            _mockPowerShellServices.VerifyNoOtherCalls();
        }
コード例 #2
0
        private Hashtable InvokeOrchestration(bool completed, PSDataCollection <object> output = null)
        {
            var invocationAsyncResult = CreateInvocationResult(completed);

            ExpectBeginInvoke(invocationAsyncResult, output);
            if (!completed)
            {
                SignalToStopInvocation();
            }

            var result = _orchestrationInvoker.Invoke(_orchestrationBindingInfo, _mockPowerShellServices.Object);

            return(result);
        }
        public static Hashtable InvokeOrchestration(
            OrchestrationInvoker orchestrationInvoker,
            OrchestrationBindingInfo orchestrationBindingInfo,
            Mock <IPowerShellServices> mockPowerShellServices,
            bool completed,
            PSDataCollection <object> output = null)
        {
            var invocationAsyncResult = CreateInvocationResult(completed);

            ExpectBeginInvoke(mockPowerShellServices, invocationAsyncResult, output);
            if (!completed)
            {
                SignalToStopInvocation(orchestrationBindingInfo);
            }

            var result = orchestrationInvoker.Invoke(orchestrationBindingInfo, mockPowerShellServices.Object);

            return(result);
        }