Пример #1
0
        static WcfBindingRegistry()
        {
            _instance = new WcfBindingRegistry();

            var machineConfiguration = ConfigurationManager.OpenMachineConfiguration();
            var modelSectionGroup    = ServiceModelSectionGroup.GetSectionGroup(machineConfiguration);

            // ReSharper disable once PossibleNullReferenceException
            foreach (var binding in modelSectionGroup.Bindings.BindingCollections)
            {
                var baseType = binding.GetType().BaseType;
                if (baseType != null && baseType.IsSubclassOfOpenGenericType(typeof(StandardBindingCollectionElement <,>)))
                {
                    _instance.Add(baseType.GenericTypeArguments[1], binding.BindingName);
                }
            }
            _instance.Add(typeof(System.ServiceModel.Configuration.CustomBindingElement), "customBinding");
        }
        public void GetBindingNameForStandardNetMsmqBindingElement()
        {
            var bindingElement = new System.ServiceModel.Configuration.NetMsmqBindingElement();

            Assert.That(WcfBindingRegistry.GetBindingName(bindingElement), Is.EqualTo("netMsmqBinding"));
        }
        public void GetBindingNameForStandardNetMsmqBindingElement()
        {
            var bindingElement = new System.ServiceModel.Configuration.NetMsmqBindingElement();

            WcfBindingRegistry.GetBindingName(bindingElement).Should().Be("netMsmqBinding");
        }
        public void GetBindingNameForDecoratedNetMsmqBindingElement()
        {
            var bindingElement = new NetMsmqBindingElement();

            Assert.That(WcfBindingRegistry.GetBindingName(bindingElement), Is.EqualTo("netMsmqBinding"));
        }
        public void GetBindingNameForDecoratedNetMsmqBindingElement()
        {
            var bindingElement = new NetMsmqBindingElement();

            WcfBindingRegistry.GetBindingName(bindingElement).Should().Be("netMsmqBinding");
        }