/// <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; }
/// <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); } }
/// <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); }
/// <summary> /// Clones binding element /// </summary> /// <returns></returns> public override BindingElement Clone() { ControlledTextMessageBindingElement clone = new ControlledTextMessageBindingElement(this); return(clone); }