private void attachMediaHandling(BehaviorChain chain, IConfigurationObserver observer)
        {
            var firstAction = chain.FirstCall();
            if (firstAction == null) return;

            observer.RecordCallStatus(firstAction, "Meets criteria {0} for Conneg".ToFormat(_description));

            var node = new ConnegNode(){
                InputType = chain.InputType(),
                OutputType = chain.Calls.Where(x => x.HasOutput).Select(x => x.OutputType()).LastOrDefault()
            };

            firstAction.AddBefore(node);
        }
Esempio n. 2
0
        public void build_object_def_with_both_input_and_output()
        {
            var node = new ConnegNode{
                InputType = typeof (ConnegNodeInput),
                OutputType = typeof (ConnegNodeOutput)
            };

            var objectDef = node.As<IContainerModel>().ToObjectDef();

            objectDef.Type.ShouldEqual(typeof (ConnegBehavior));

            objectDef.DependencyFor<IConnegInputHandler>().ShouldBeOfType<ConfiguredDependency>()
                .Definition.Type.ShouldEqual(typeof(ConnegInputHandler<ConnegNodeInput>));

            objectDef.DependencyFor<IConnegOutputHandler>().ShouldBeOfType<ConfiguredDependency>()
                .Definition.Type.ShouldEqual(typeof(ConnegOutputHandler<ConnegNodeOutput>));
        }
Esempio n. 3
0
        private void attachMediaHandling(BehaviorChain chain, IConfigurationObserver observer)
        {
            var firstAction = chain.FirstCall();

            if (firstAction == null)
            {
                return;
            }

            observer.RecordCallStatus(firstAction, "Meets criteria {0} for Conneg".ToFormat(_description));

            var node = new ConnegNode()
            {
                InputType  = chain.InputType(),
                OutputType = chain.Calls.Where(x => x.HasOutput).Select(x => x.OutputType()).LastOrDefault()
            };

            firstAction.AddBefore(node);
        }