Exemple #1
0
        public static IEndpoint AddSecureWSHttpEndpoint(this IServiceHostConfigurator configurator, Type contract, HttpEndpointAddress address, Action <WSHttpBinding> configureBinding = null)
        {
            if (configurator is null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            if (contract is null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (address is null)
            {
                throw new ArgumentNullException(nameof(address));
            }

            var secureAddress = new HttpEndpointAddress {
                Host = address.Host, IsSecure = true, Path = address.Path, Port = address.Port
            };

            return(configurator.AddWSHttpEndpoint(contract, secureAddress, ConfigureBinding));

            void ConfigureBinding(WSHttpBinding binding)
            {
                binding.UseHttps();
                configureBinding?.Invoke(binding);
            }
        }
Exemple #2
0
        public void AddWSHttpEndpoint_forwards_to_configurator(IServiceHostConfigurator configurator, Action <WSHttpBinding> testDelegate, HttpEndpointAddress address)
        {
            configurator.AddWSHttpEndpoint(typeof(ITestService), address, testDelegate);

            Mock.Get(configurator).Verify(p => p.AddEndpoint <WSHttpBinding>(typeof(ITestService), address, testDelegate));
        }