public void CurrentUtcDateTime_InitializesToFirstOrchestratorStartedTimestamp_IfOrchestratorInvoked(bool firstExecution, bool completed) { var history = CreateOrchestratorStartedHistory(startTime: _startTime, isProcessed: false); var context = new OrchestrationContext { History = history }; if (!firstExecution) { // Assumes that a context, when passed to OrchestrationInvoker, has all HistoryEvents' IsProcessed reset to false history = DurableTestUtilities.MergeHistories( history, CreateActivityHistory(name: FunctionName, scheduled: true, completed: true, output: InvocationResultJson, date: _restartTime, orchestratorStartedIsProcessed: false) ); context.CurrentUtcDateTime = _restartTime; } _orchestrationBindingInfo = new OrchestrationBindingInfo("ContextParameterName", context); InvokeOrchestration(completed: completed); Assert.Equal(_orchestrationBindingInfo.Context.History.FirstOrDefault( (e) => e.EventType == HistoryEventType.OrchestratorStarted).Timestamp, _orchestrationBindingInfo.Context.CurrentUtcDateTime); }
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); }
public void CurrentUtcDateTime_InitializesToFirstOrchestratorStartedTimestamp_IfOrchestratorInvoked(bool firstExecution, bool completed) { if (firstExecution) { _orchestrationBindingInfo = new OrchestrationBindingInfo( "ContextParameterName", new OrchestrationContext { History = CreateOrchestratorStartedHistory(date: time, isProcessed: false) } ); } else { DateTime startTime = time; DateTime restartTime = startTime.AddMilliseconds(intervalMilliseconds); // Assumes that a context, when passed to OrchestrationInvoker, has all HistoryEvents' IsProcessed reset to false var history = MergeHistories( CreateOrchestratorStartedHistory(date: time, isProcessed: false), CreateActivityHistory(name: FunctionName, scheduled: true, completed: true, output: InvocationResultJson, date: restartTime, orchestratorStartedIsProcessed: false) ); var context = new OrchestrationContext { History = history, CurrentUtcDateTime = restartTime }; _orchestrationBindingInfo = new OrchestrationBindingInfo("ContextParameterName", context); } InvokeOrchestration(completed: completed); Assert.Equal(_orchestrationBindingInfo.Context.History.FirstOrDefault( (e) => e.EventType == HistoryEventType.OrchestratorStarted).Timestamp, _orchestrationBindingInfo.Context.CurrentUtcDateTime); }
public static void SignalToStopInvocation(OrchestrationBindingInfo orchestrationBindingInfo) { orchestrationBindingInfo.Context.OrchestrationActionCollector.Stop(); }