コード例 #1
0
        public void ChannelFactory_WithSingleConfigurationForContract_UsesDefaultConfiguration()
        {
            var factory = ChannelFactoryProvider.GetChannelFactory <ITestServiceSingleEndpointConfig>();

            Assert.That(factory.Endpoint.Address.ToString(), Is.EqualTo("http://localhost:23456/TestService2"));
            Assert.That(factory.Endpoint.Binding.Name, Is.EqualTo("WSHttpBinding"));
        }
コード例 #2
0
        public void ChannelFactories_WithNonIdenticalConfiguration_AreNotSameInstance__ForEndpointConfigurationName()
        {
            var factory1 = ChannelFactoryProvider.GetChannelFactory <ITestService>("ITestService");
            var factory2 = ChannelFactoryProvider.GetChannelFactory <ITestService>("ITestService2");

            Assert.AreNotSame(factory1, factory2);
        }
コード例 #3
0
        public void ChannelFactory_FromEndpointConfigurationName_WithoutBehaviorConfiguratio_DoesNotContainEndpointBehaviors()
        {
            var factory  = ChannelFactoryProvider.GetChannelFactory <ITestService>("ITestService");
            var behavior = factory.Endpoint.Behaviors.Find <WebHttpBehavior>();

            Assert.That(behavior, Is.Null);
        }
コード例 #4
0
        public void ChannelFactory_FromEndpointConfigurationName_WithBehaviorConfiguration_ContainsConfiguredBehaviors()
        {
            var factory  = ChannelFactoryProvider.GetChannelFactory <ITestService>("BehaviorService");
            var behavior = factory.Endpoint.Behaviors.Find <WebHttpBehavior>();

            Assert.That(behavior, Is.Not.Null);
            Assert.That(behavior.HelpEnabled, Is.True);
        }
コード例 #5
0
        public void ChannelFactory_ClientEndpoint_WithCustomBindingConfiguration()
        {
            var factory = ChannelFactoryProvider.GetChannelFactory <ITestService>("ITestService");

            Assert.That(factory.Endpoint.Address.ToString(), Is.EqualTo("http://localhost:23456/TestService"));

            var binding = (WSHttpBinding)factory.Endpoint.Binding;

            Assert.That(binding.Name, Is.EqualTo("wsHttpBinding_ITestService"));
            Assert.That(binding.MaxReceivedMessageSize, Is.EqualTo(12345));
        }
コード例 #6
0
        public void ChannelFactories_WithNonIdenticalConfiguration_AreNotSameInstance_ForCodeBasedConfiguration()
        {
            var factory1 = ChannelFactoryProvider.GetChannelFactory <ITestService>(
                new WSHttpBinding(),
                new EndpointAddress("http://localhost:23456/TestService"));

            var factory2 = ChannelFactoryProvider.GetChannelFactory <ITestService>(
                new WSHttpBinding(),
                new EndpointAddress("http://localhost:23456/TestService2"));

            Assert.AreNotSame(factory1, factory2);
        }
コード例 #7
0
 public void ServiceInterface_WithMultipleClientEndpoints_ThrowsInvalidOperationException_WhenUsingDefaultCtor()
 {
     Assert.That(() => ChannelFactoryProvider.GetChannelFactory <ITestService>(), Throws.TypeOf <InvalidOperationException>());
 }
コード例 #8
0
 public void NoConfigurationForServiceType_ThrowsInvalidOperationException()
 {
     Assert.That(() => ChannelFactoryProvider.GetChannelFactory <IAsyncTestInterface>(), Throws.TypeOf <InvalidOperationException>());
 }