Microsoft.ApplicationInsights.Wcf.Tests.ClientTelemetryEndpointBehaviorTests.GetInnerChannel(object)

Here are the examples of the csharp api class Microsoft.ApplicationInsights.Wcf.Tests.ClientTelemetryEndpointBehaviorTests.GetInnerChannel(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: ApplicationInsights-SDK-Labs
Source File: ClientTelemetryEndpointBehaviorTests.cs
[TestMethod]
        [TestCategory("Client")]
        public void BehaviorAddsCustomBinding()
        {
            using (var host = new HostingContext<SimpleService, ISimpleService>())
            {
                var binding = new NetTcpBinding();
                var configuration = new TelemetryConfiguration();
                var factory = new ChannelFactory<ISimpleService>(binding, host.GetServiceAddress());
                ISimpleService channel = null;
                try
                {
                    var behavior = new ClientTelemetryEndpointBehavior(configuration);
#if NET40
                    factory.Endpoint.Behaviors.Add(behavior);
#else
                    factory.Endpoint.EndpointBehaviors.Add(behavior);
#endif

                    channel = factory.CreateChannel();
                    var innerChannel = GetInnerChannel(channel);
                    ((IClientChannel)channel).Close();
                    factory.Close();

                    Assert.IsInstanceOfType(innerChannel, typeof(ClientTelemetryChannelBase), "Telemetry channel is missing");
                }
                catch
                {
                    factory.Abort();
                    if (channel != null)
                    {
                        ((IClientChannel)channel).Abort();
                    }

                    throw;
                }
            }
        }