Ejemplo n.º 1
0
        public void Data_flows_from_output_to_input_operations(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation<object> { OutputValue = output };
            var inputOperation = new FakeInputOperation<object>();
            sut.RegisterOutputHandlers(outputOperation);

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

            Assert.Equal(outputOperation.OutputValue, inputOperation.ProvidedInput);
        }
        public void You_can_get_output_of_a_specialized_type_directly_from_the_context_if_you_ask_for_it_explicitly(IOperation op, string output)
        {
            var sut             = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation <string> {
                OutputValue = output
            };

            sut.RegisterOutputHandlers(outputOperation);
            outputOperation.Execute();

            var result = sut.GetOutput <object>(allowSpecializedClasses: true);

            Assert.Equal(outputOperation.OutputValue, result);
        }
        public void You_cannot_get_output_of_a_specialized_type_directly_from_the_context(IOperation op, string output)
        {
            var sut             = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation <string> {
                OutputValue = output
            };

            sut.RegisterOutputHandlers(outputOperation);
            outputOperation.Execute();

            var result = sut.GetOutput <object>(allowSpecializedClasses: false);

            Assert.Null(result);
        }
        public void You_can_get_output_directly_from_the_context(IOperation op, object output)
        {
            var sut             = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation <object> {
                OutputValue = output
            };

            sut.RegisterOutputHandlers(outputOperation);
            outputOperation.Execute();

            var result = sut.GetOutput <object>();

            Assert.Equal(outputOperation.OutputValue, result);
        }
        public void Data_flows_from_output_to_input_operations(IOperation op, object output)
        {
            var sut             = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation <object> {
                OutputValue = output
            };
            var inputOperation = new FakeInputOperation <object>();

            sut.RegisterOutputHandlers(outputOperation);

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

            Assert.Equal(outputOperation.OutputValue, inputOperation.ProvidedInput);
        }
        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);
        }
Ejemplo n.º 7
0
        public void The_most_recently_outputted_instance_of_a_data_type_is_available_as_input(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation1 = new FakeOutputOperation<object> { OutputValue = output };
            var outputOperation2 = new FakeOutputOperation<object> { OutputValue = output };
            var inputOperation = new FakeInputOperation<object>();
            sut.RegisterOutputHandlers(outputOperation1);
            sut.RegisterOutputHandlers(outputOperation2);

            outputOperation1.Execute();
            outputOperation2.Execute();
            sut.ProvideInputs(inputOperation);

            Assert.Equal(outputOperation2.OutputValue, inputOperation.ProvidedInput);
        }
        public void The_most_recently_outputted_instance_of_a_data_type_is_available_as_input(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation1 = new FakeOutputOperation <object> {
                OutputValue = output
            };
            var outputOperation2 = new FakeOutputOperation <object> {
                OutputValue = output
            };
            var inputOperation = new FakeInputOperation <object>();

            sut.RegisterOutputHandlers(outputOperation1);
            sut.RegisterOutputHandlers(outputOperation2);

            outputOperation1.Execute();
            outputOperation2.Execute();
            sut.ProvideInputs(inputOperation);

            Assert.Equal(outputOperation2.OutputValue, inputOperation.ProvidedInput);
        }
        public void Data_flows_from_the_most_recent_output_to_the_following_input_operation(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation1 = new FakeOutputOperation <object> {
                OutputValue = output
            };
            var outputOperation2 = new FakeOutputOperation <object> {
                OutputValue = output
            };
            var inputOperation1 = new FakeInputOperation <object>();
            var inputOperation2 = new FakeInputOperation <object>();

            sut.RegisterOutputHandlers(outputOperation1);
            sut.RegisterOutputHandlers(outputOperation2);

            outputOperation1.Execute();
            sut.ProvideInputs(inputOperation1);
            outputOperation2.Execute();
            sut.ProvideInputs(inputOperation2);

            Assert.Equal(outputOperation1.OutputValue, inputOperation1.ProvidedInput);
            Assert.Equal(outputOperation2.OutputValue, inputOperation2.ProvidedInput);
        }
Ejemplo n.º 10
0
        public void Data_flows_from_the_most_recent_output_to_the_following_input_operation(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation1 = new FakeOutputOperation<object> { OutputValue = output };
            var outputOperation2 = new FakeOutputOperation<object> { OutputValue = output };
            var inputOperation1 = new FakeInputOperation<object>();
            var inputOperation2 = new FakeInputOperation<object>();
            sut.RegisterOutputHandlers(outputOperation1);
            sut.RegisterOutputHandlers(outputOperation2);

            outputOperation1.Execute();
            sut.ProvideInputs(inputOperation1);
            outputOperation2.Execute();
            sut.ProvideInputs(inputOperation2);

            Assert.Equal(outputOperation1.OutputValue, inputOperation1.ProvidedInput);
            Assert.Equal(outputOperation2.OutputValue, inputOperation2.ProvidedInput);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        public void You_can_get_output_directly_from_the_context(IOperation op, object output)
        {
            var sut = OperationContext.Create(op);
            var outputOperation = new FakeOutputOperation<object> { OutputValue = output };
            sut.RegisterOutputHandlers(outputOperation);
            outputOperation.Execute();

            var result = sut.GetOutput<object>();

            Assert.Equal(outputOperation.OutputValue, result);
        }