예제 #1
0
        /// <summary>
        /// Constructor (for cloning)
        /// </summary>
        /// <param name="binding"></param>
        ControlledTextMessageBindingElement(ControlledTextMessageBindingElement binding)
            : this(binding.Encoding, binding.MediaType, binding.MessageVersion)
        {
            this.readerQuotas = new XmlDictionaryReaderQuotas();
            binding.ReaderQuotas.CopyTo(this.readerQuotas);

            _controllers = binding._controllers;
        }
예제 #2
0
        /// <summary>
        /// Sets up the channel to spoil the messages (for fault tests)
        /// </summary>
        /// <param name="spoiler">Object to process the message.</param>
        /// <param name="endpoint"></param>
        protected void SetBreakingBehaviour(ServiceEndpoint endpoint, ISoapMessageMutator spoiler)
        {
            Binding binding = endpoint.Binding;

            TestTool.HttpTransport.ControlledTextMessageBindingElement traceElement = (HttpTransport.ControlledTextMessageBindingElement)binding.CreateBindingElements()[0];

            if (spoiler != null)
            {
                traceElement.Controllers.Add(spoiler);
            }
            else
            {
                traceElement.Controllers.RemoveAll(c => c is ISoapMessageMutator);
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes binding elements.
        /// </summary>
        void Initialize()
        {
            List <IChannelController> transportControllers = new List <IChannelController>();
            List <IChannelController> encoderControllers   = new List <IChannelController>();

            foreach (IChannelController controller in _controllers)
            {
                ITransportController transportController = controller as ITransportController;
                IEncodingController  encodingController  = controller as IEncodingController;

                if (transportController != null)
                {
                    transportControllers.Add(transportController);
                }
                if (encodingController != null)
                {
                    encoderControllers.Add(encodingController);
                }
            }

            _transport = new HttpTransportBindingElement(transportControllers);
            _encoding  = new ControlledTextMessageBindingElement();
            _encoding.AddControllers(encoderControllers);
        }
예제 #4
0
        /// <summary>
        /// Clones binding element
        /// </summary>
        /// <returns></returns>
        public override BindingElement Clone()
        {
            ControlledTextMessageBindingElement clone = new ControlledTextMessageBindingElement(this);

            return(clone);
        }