Exemplo n.º 1
0
        public void HttpBindingElement_Ctor_Initializes_All_Properties()
        {
            HttpBindingElement element = new HttpBindingElement();
            HttpBinding binding = new HttpBinding();

            Assert.AreEqual(binding.CloseTimeout, element.CloseTimeout, "The HttpBinding and HttpBindingElement should have the same default CloseTimeout");
            Assert.AreEqual(binding.HostNameComparisonMode, element.HostNameComparisonMode, "The HttpBinding and HttpBindingElement should have the same default HostNameComparisonMode");
            Assert.AreEqual(binding.MaxBufferPoolSize, element.MaxBufferPoolSize, "The HttpBinding and HttpBindingElement should have the same default MaxBufferPoolSize");
            Assert.AreEqual(binding.MaxBufferSize, element.MaxBufferSize, "The HttpBinding and HttpBindingElement should have the same default MaxBufferSize");
            Assert.AreEqual(binding.MaxReceivedMessageSize, element.MaxReceivedMessageSize, "The HttpBinding and HttpBindingElement should have the same default MaxReceivedMessageSize");
            Assert.AreEqual(binding.OpenTimeout, element.OpenTimeout, "The HttpBinding and HttpBindingElement should have the same default OpenTimeout");
            Assert.AreEqual(binding.ReceiveTimeout, element.ReceiveTimeout, "The HttpBinding and HttpBindingElement should have the same default ReceiveTimeout");
            Assert.AreEqual(binding.SendTimeout, element.SendTimeout, "The HttpBinding and HttpBindingElement should have the same default ReceiveTimeout");
            Assert.AreEqual(binding.TransferMode, element.TransferMode, "The HttpBinding and HttpBindingElement should have the same default TransferMode");
        }
Exemplo n.º 2
0
        private void ApplyConfiguration(string configurationName)
        {
            HttpBindingCollectionElement section = HttpBindingCollectionElement.GetBindingCollectionElement();

            HttpBindingElement element = null;

            if (section != null && section.Bindings.ContainsKey(configurationName))
            {
                element = section.Bindings[configurationName];
            }

            if (element == null)
            {
                throw Fx.Exception.AsError(
                          new ConfigurationErrorsException(
                              SR.ConfigInvalidBindingConfigurationName(
                                  configurationName,
                                  CollectionElementName)));
            }

            element.ApplyConfiguration(this);
        }