public void ReturnsNoActionsWhenNoneAdded() { var collector = new OrchestrationActionCollector(); var(_, actions) = collector.WaitForActions(new AutoResetEvent(initialState: true)); Assert.Empty(actions); }
public void IndicatesShouldNotStopOnSignalledCompletionWaitHandle() { var collector = new OrchestrationActionCollector(); var(shouldStop, _) = collector.WaitForActions(new AutoResetEvent(initialState: true)); Assert.False(shouldStop); }
public void IndicatesShouldStopOnStopEvent() { var collector = new OrchestrationActionCollector(); collector.Stop(); var(shouldStop, _) = collector.WaitForActions(new AutoResetEvent(initialState: false)); Assert.True(shouldStop); }
public void ReturnsSingleAction() { var collector = new OrchestrationActionCollector(); collector.Add(_expectedActions[0]); var(_, actions) = collector.WaitForActions(new AutoResetEvent(initialState: true)); Assert.Single(actions); Assert.Single(actions.Single()); Assert.Same(_expectedActions[0], actions.Single().Single()); }
public void ReturnsParallelActions() { var collector = new OrchestrationActionCollector(); collector.Add(_expectedActions[0]); collector.Add(_expectedActions[1]); var(_, actions) = collector.WaitForActions(new AutoResetEvent(initialState: true)); var expected = new[] { new[] { _expectedActions[0], _expectedActions[1] } }; AssertExpectedActions(expected, actions); }
public void ReturnsMixOfSequentialAndParallelActions() { var collector = new OrchestrationActionCollector(); collector.Add(_expectedActions[0]); collector.NextBatch(); collector.Add(_expectedActions[1]); collector.Add(_expectedActions[2]); collector.NextBatch(); collector.Add(_expectedActions[3]); collector.NextBatch(); collector.Add(_expectedActions[4]); collector.Add(_expectedActions[5]); collector.Add(_expectedActions[6]); collector.NextBatch(); collector.Add(_expectedActions[7]); collector.NextBatch(); collector.Add(_expectedActions[8]); collector.NextBatch(); collector.Add(_expectedActions[9]); collector.NextBatch(); collector.Add(_expectedActions[10]); collector.Add(_expectedActions[11]); collector.Add(_expectedActions[12]); collector.Add(_expectedActions[13]); var(_, actions) = collector.WaitForActions(new AutoResetEvent(initialState: true)); var expected = new[] { new[] { _expectedActions[0] }, new[] { _expectedActions[1], _expectedActions[2] }, new[] { _expectedActions[3] }, new[] { _expectedActions[4], _expectedActions[5], _expectedActions[6] }, new[] { _expectedActions[7] }, new[] { _expectedActions[8] }, new[] { _expectedActions[9] }, new[] { _expectedActions[10], _expectedActions[11], _expectedActions[12], _expectedActions[13] } }; AssertExpectedActions(expected, actions); }