public void You_can_create_a_new_operation_from_an_initialized_operation_instance()
        {
            var resolver             = new SimpleOperationResolver();
            var correctConfiguration = new FakeWorkflowConfiguration {
                Resolver = resolver
            };
            var sut = new FakeOperation();

            sut.Initialize(correctConfiguration);

            var result = sut.PublicCreate <TestOperation>() as TestOperation;

            Assert.NotNull(result);
        }
        public void You_cannot_create_an_operation_with_an_input_value_without_specifying_an_input_property_with_the_proper_type(IEnumerable <string> input)
        {
            var resolver = new SimpleOperationResolver();
            var factory  = new FakeOperationBehaviorFactory();

            factory.OperationBehaviors.Add(new FakeOperationBehavior());
            var correctConfiguration = new FakeWorkflowConfiguration {
                Resolver = resolver
            }.WithBehaviorFactory(factory);
            var sut = new FakeOperation();

            sut.Initialize(correctConfiguration);

            Assert.Throws <ArgumentException>(() => sut.PublicCreate <SimpleTestPropertyInputOperation, IEnumerable <string> >(input));
        }
        public void Created_input_operations_are_provided_with_one_property_input_value(object input)
        {
            var resolver             = new SimpleOperationResolver();
            var correctConfiguration = new FakeWorkflowConfiguration {
                Resolver = resolver
            };
            var sut = new FakeOperation();

            sut.Initialize(correctConfiguration);

            var result = sut.PublicCreate <SimpleTestPropertyInputOperation, object>(input) as SimpleTestPropertyInputOperation;

            Assert.NotNull(result.Input);
            Assert.Equal(input, result.Input);
        }
        public void Created_input_operations_are_provided_with_input_values_when_having_behaviors(object input)
        {
            var resolver = new SimpleOperationResolver();
            var factory  = new FakeOperationBehaviorFactory();

            factory.OperationBehaviors.Add(new FakeOperationBehavior());
            var correctConfiguration = new FakeWorkflowConfiguration {
                Resolver = resolver
            }.WithBehaviorFactory(factory);
            var sut = new FakeOperation();

            sut.Initialize(correctConfiguration);

            var result = sut.PublicCreate <SimpleTestPropertyInputOperation, object>(input).GetInnermostOperation() as SimpleTestPropertyInputOperation;

            Assert.NotNull(result.Input);
            Assert.Equal(input, result.Input);
        }
        public void Created_input_operations_are_provided_with_two_input_values(Tuple <object> input1, Tuple <object, object> input2)
        {
            var resolver             = new SimpleOperationResolver();
            var correctConfiguration = new FakeWorkflowConfiguration {
                Resolver = resolver
            };
            var sut = new FakeOperation();

            sut.Initialize(correctConfiguration);

            var result = sut.PublicCreate <SimpleTestPropertyInputOperation <Tuple <object>, Tuple <object, object>, object>, Tuple <object>, Tuple <object, object> >(input1, input2) as SimpleTestPropertyInputOperation <Tuple <object>, Tuple <object, object>, object>;

            Assert.NotNull(result.Input1);
            Assert.Equal(input1, result.Input1);
            Assert.NotNull(result.Input2);
            Assert.Equal(input2, result.Input2);
            Assert.Null(result.Input3);
        }