Exemplo n.º 1
0
        public static IEndpoint AddSecureBasicHttpEndpoint(this IServiceHostConfigurator configurator, Type contract, HttpEndpointAddress address, Action <BasicHttpBinding> 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.AddBasicHttpEndpoint(contract, secureAddress, ConfigureBinding));

            void ConfigureBinding(BasicHttpBinding binding)
            {
                binding.UseHttps();
                configureBinding?.Invoke(binding);
            }
        }
Exemplo n.º 2
0
        public void AddBasicHttpEndpoint_forwards_to_configurator(IServiceHostConfigurator configurator, Action <BasicHttpBinding> testDelegate, HttpEndpointAddress address)
        {
            configurator.AddBasicHttpEndpoint(typeof(ITestService), address, testDelegate);

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