public void WhenChannelIsOpenedWithTimeout_InnerChannelEventsAreHooked()
        {
            var innerChannel = new MockClientChannel(SvcUrl);

            TestTelemetryChannel.Clear();
            var channel = GetChannel(innerChannel, typeof(ISimpleService));

            channel.Open(TimeSpan.FromSeconds(10));

            Assert.IsTrue(innerChannel.OpeningIsHooked(), "Opening event is not hooked");
            Assert.IsTrue(innerChannel.OpenedIsHooked(), "Opened event is not hooked");
            Assert.IsTrue(innerChannel.ClosingIsHooked(), "Closing event is not hooked");
            Assert.IsTrue(innerChannel.ClosedIsHooked(), "Closed event is not hooked");
            Assert.IsTrue(innerChannel.FaultedIsHooked(), "Faulted event is not hooked");
        }
        public void WhenChannelIsAborted_InnerChannelEventsAreUnhooked()
        {
            var innerChannel = new MockClientChannel(SvcUrl);

            TestTelemetryChannel.Clear();
            var channel = GetChannel(innerChannel, typeof(ISimpleService));

            channel.Open();
            channel.Abort();

            Assert.IsFalse(innerChannel.OpeningIsHooked(), "Opening event is hooked");
            Assert.IsFalse(innerChannel.OpenedIsHooked(), "Opened event is hooked");
            Assert.IsFalse(innerChannel.ClosingIsHooked(), "Closing event is hooked");
            Assert.IsFalse(innerChannel.ClosedIsHooked(), "Closed event is hooked");
            Assert.IsFalse(innerChannel.FaultedIsHooked(), "Faulted event is hooked");
        }
        public void WhenChannelIsOpenedAsync_InnerChannelEventsAreHooked()
        {
            var innerChannel = new MockClientChannel(SvcUrl);

            TestTelemetryChannel.Clear();
            var channel = GetChannel(innerChannel, typeof(ISimpleService));
            var result  = channel.BeginOpen(null, null);

            channel.EndOpen(result);

            Assert.IsTrue(innerChannel.OpeningIsHooked(), "Opening event is not hooked");
            Assert.IsTrue(innerChannel.OpenedIsHooked(), "Opened event is not hooked");
            Assert.IsTrue(innerChannel.ClosingIsHooked(), "Closing event is not hooked");
            Assert.IsTrue(innerChannel.ClosedIsHooked(), "Closed event is not hooked");
            Assert.IsTrue(innerChannel.FaultedIsHooked(), "Faulted event is not hooked");
        }
        public void WhenChannelIsClosedAsyncWithTimeout_InnerChannelEventsAreUnhooked()
        {
            var innerChannel = new MockClientChannel(SvcUrl);

            TestTelemetryChannel.Clear();
            var channel = GetChannel(innerChannel, typeof(ISimpleService));

            channel.Open();
            var result = channel.BeginClose(TimeSpan.FromSeconds(10), null, null);

            channel.EndClose(result);

            Assert.IsFalse(innerChannel.OpeningIsHooked(), "Opening event is hooked");
            Assert.IsFalse(innerChannel.OpenedIsHooked(), "Opened event is hooked");
            Assert.IsFalse(innerChannel.ClosingIsHooked(), "Closing event is hooked");
            Assert.IsFalse(innerChannel.ClosedIsHooked(), "Closed event is hooked");
            Assert.IsFalse(innerChannel.FaultedIsHooked(), "Faulted event is hooked");
        }