Ejemplo n.º 1
0
        public void events_can_be_registered_for_Executor_instance()
        {
            // Arrange
            var eventHandled = false;

            var events = new TaskExecutionEvents(
                taskStarted: _ => eventHandled = true);

            var task = new TaskDefinition(
                BasicTaskStep.Empty("Step"));

            // Act
            var executor = TaskExecutorFactory.Create(ResolverType.Sequential, events);

            executor.Execute(task);

            // Assert
            eventHandled.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public void global_and_one_time_events_are_merged()
        {
            // Arrange
            var globalEventHandled = false;
            var globalEvents       = new TaskExecutionEvents(
                taskStarted: _ => globalEventHandled = true);

            var oneTimeEventHandled = false;
            var oneTimeEvents       = new TaskExecutionEvents(
                taskStarted: _ => oneTimeEventHandled = true);

            var task = new TaskDefinition(
                BasicTaskStep.Empty("Step"));

            // Act
            var executor = TaskExecutorFactory.Create(ResolverType.Sequential, globalEvents);

            executor.Execute(task, events: oneTimeEvents);

            // Assert
            globalEventHandled.Should().BeTrue();
            oneTimeEventHandled.Should().BeTrue();
        }