public void InstanceProviderReleaseCalledWithCorrectObjectTest()
        {
            var instanceProvider = new TestInstanceProvider();
            var behavior         = new TestServiceBehavior {
                InstanceProvider = instanceProvider
            };
            var factory = ExtensibilityHelper.CreateChannelFactory <SimpleService, ISimpleService>(behavior);

            factory.Open();
            var channel = factory.CreateChannel();
            var echo    = channel.Echo("hello");

            Assert.Equal("hello", echo);
            Assert.True(instanceProvider.InstanceHashCode > 0);;
            Assert.True(instanceProvider.ReleasedInstanceHashCode == instanceProvider.InstanceHashCode);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }
        public void InstanceProviderCalledTest()
        {
            var instanceProvider = new TestInstanceProvider();
            var behavior         = new TestServiceBehavior {
                InstanceProvider = instanceProvider
            };
            var factory = ExtensibilityHelper.CreateChannelFactory <SimpleService, ISimpleService>(behavior);

            factory.Open();
            var channel = factory.CreateChannel();
            var echo    = channel.Echo("hello");

            Assert.Equal("hello", echo);
            Assert.Equal(1, instanceProvider.GetInstanceCallCount);
            Assert.Equal(1, instanceProvider.ReleaseInstanceCallCount);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }