public void ServiceType_returns_configuration_serviceType([Frozen] IServiceHostConfiguration <TestService> configuration, WcfServiceHostedServiceConfiguration <TestService> sut)
        {
            Mock.Get(configuration).SetupGet(p => p.ServiceType).Returns(typeof(TestService));

            Assert.That(sut.ServiceType, Is.EqualTo(configuration.ServiceType));
            Assert.That(sut.ServiceType, Is.EqualTo(typeof(TestService)));
        }
Beispiel #2
0
        /// <summary>
        /// Constructs a service mount that hosts services on the specified base URI
        /// using the specified service host configuration.
        /// </summary>
        /// <param name="baseAddress"></param>
        /// <param name="configuration"></param>
        public ServiceMount(Uri baseAddress, IServiceHostConfiguration configuration)
        {
            _baseAddress   = baseAddress;
            _configuration = configuration;

            // establish default certificate search parameters consistent with behaviour prior to #8219
            _certificateSearchDirective = CertificateSearchDirective.CreateBasic(_baseAddress);
        }
Beispiel #3
0
		/// <summary>
		/// Constructs a service mount that hosts services on the specified base URI
		/// using the specified service host configuration.
		/// </summary>
		/// <param name="baseAddress"></param>
		/// <param name="configuration"></param>
		public ServiceMount(Uri baseAddress, IServiceHostConfiguration configuration)
		{
			_baseAddress = baseAddress;
			_configuration = configuration;

			// establish default certificate search parameters consistent with behaviour prior to #8219
			_certificateSearchDirective = CertificateSearchDirective.CreateBasic(_baseAddress);
		}
Beispiel #4
0
 public void Remove(IServiceHostConfiguration configurator)
 {
     if (configurator == null)
     {
         throw new ArgumentNullException();
     }
     if (configurator != _defaultConfiguration)
     {
         _configurations.Remove(configurator);
     }
 }
Beispiel #5
0
 public void Add(IServiceHostConfiguration configurator)
 {
     if (configurator == null)
     {
         throw new ArgumentNullException();
     }
     if (!_configurations.Contains(configurator))
     {
         _configurations.Add(configurator);
     }
 }
 public ServiceMount(Uri baseAddress, IServiceHostConfiguration configuration)
     : base(baseAddress, configuration)
 {
 }
Beispiel #7
0
 public ServiceMount(Uri baseAddress, IServiceHostConfiguration configuration) 
     : base(baseAddress, configuration)
 {
 }
        public void CreateServiceHost_uses_configuration([Frozen] IServiceHostConfiguration <TestService> configuration, WcfServiceHostedServiceConfiguration <TestService> sut)
        {
            var host = sut.CreateServiceHost();

            Mock.Get(configuration).Verify(p => p.ConfigureServiceHost(It.IsAny <ServiceHost>()));
        }
Beispiel #9
0
        /// <summary>
        /// Add service behavior to a service host
        /// </summary>
        /// <typeparam name="TService">The service implementation type</typeparam>
        /// <param name="configuration">The service host configuration</param>
        /// <param name="behavior">The service behavior</param>
        /// <returns>The service host configuration</returns>
        public static IServiceHostConfiguration <TService> WithServiceBehavior <TService>(this IServiceHostConfiguration <TService> configuration, IServiceBehavior behavior)
        {
            var provider = new ServiceBehaviorProvider <TService>(behavior);

            configuration.Services.AddSingleton <ServiceBehaviorProvider <TService> >(provider);
            return(configuration);
        }
Beispiel #10
0
        /// <summary>
        /// Adds service metadata behavior to a service host
        /// </summary>
        /// <typeparam name="TService">The service implementation type</typeparam>
        /// <param name="configuration">The service host configuration</param>
        /// <param name="action">Configuration action for the service metadata behavior</param>
        /// <returns>The service host configuration</returns>
        public static IServiceHostConfiguration <TService> WithServiceMetadataBehavior <TService>(this IServiceHostConfiguration <TService> configuration, Action <ServiceMetadataBehavior> action)
        {
            var behavior = new ServiceMetadataBehavior();

            action(behavior);
            return(configuration.WithServiceBehavior(behavior));
        }
Beispiel #11
0
 /// <summary>
 /// Adds service metadata behavior to a service host
 /// </summary>
 /// <typeparam name="TService">The service implementation type</typeparam>
 /// <param name="configuration">The service host configuration</param>
 /// <returns>The service host configuration</returns>
 public static IServiceHostConfiguration <TService> WithServiceMetadataBehavior <TService>(this IServiceHostConfiguration <TService> configuration)
 {
     return(configuration.WithServiceMetadataBehavior(behavior =>
     {
         behavior.HttpGetEnabled = true;
         behavior.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
     }));
 }
 public WcfServiceHostedServiceConfiguration(IServiceHostBuilder serviceHostBuilder, IServiceHostConfiguration <TService> configuration)
 {
     _serviceHostBuilder       = serviceHostBuilder ?? throw new ArgumentNullException(nameof(serviceHostBuilder));
     _serviceHostConfiguration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
 /// <summary>
 /// Creates Gaia service host
 /// </summary>
 /// <param name="hostconfig"></param>
 /// <returns></returns>
 public abstract ServiceHostBase CreateServiceHost(IServiceHostConfiguration hostconfig);
Beispiel #14
0
 /// <summary>
 ///   This method creates instance of new WCF service host using Unity as IoC container
 /// </summary>
 /// <param name="hostconfig"></param>
 /// <returns></returns>
 public override ServiceHostBase CreateServiceHost(IServiceHostConfiguration hostconfig)
 {
     return(new IoCServiceHost(Container.Instance, hostconfig.ServiceType));
 }