public void The_innermost_operation_is_considered_for_conditional_execution()
        {
            var operation = new SkippableOperation { SkipExecution = true };
            var innerBehavior = new FakeOperationBehavior().AttachTo(operation);
            var sut = new ConditionalExecutionBehavior().AttachTo(innerBehavior);

            sut.Execute();

            Assert.False(operation.HasExecuted);
        }
        public void The_innermost_operation_is_logged_as_the_source(FakeWorkflowLogger logger, Exception error)
        {
            var innerOperation = new FakeOperation { ThrowOnExecute = error };
            var behavior = new FakeOperationBehavior().AttachTo(innerOperation);
            var sut = new OperationErrorLoggingBehavior(logger).AttachTo(behavior);

            ExecuteIgnoringErrors(sut.Execute);

            Assert.Equal(1, logger.OperationFailures[innerOperation].Count);
        }
        public void Data_flows_from_output_to_nested_decorated_input_operations(IOperation op, object output, FakeInputOperation<object> inputOperation)
        {
            var sut = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation<object> { OutputValue = output };
            var decoratedInputOperation = new FakeOperationBehavior().AttachTo(new FakeOperationBehavior().AttachTo(inputOperation));
            sut.RegisterOutputHandlers(outputOperation);

            outputOperation.Execute();
            sut.ProvideInputs(decoratedInputOperation);

            Assert.Equal(outputOperation.OutputValue, inputOperation.ProvidedInput);
        }
        public void Registering_output_handlers_calls_registration_methods_on_nested_decorated_output_operation(FakeOutputOperation<object> decoratedOperation)
        {
            var sut = OperationContext.Create(new FakeOperation());
            var operation = new FakeOperationBehavior().AttachTo(new FakeOperationBehavior().AttachTo(decoratedOperation));

            sut.RegisterOutputHandlers(operation);

            Assert.NotNull(decoratedOperation.OnReceiveOutput);
        }