< Summary

Class:Azure.Core.TestFramework.InstrumentClientInterceptor
Assembly:Azure.Core.TestFramework
File(s):C:\Git\azure-sdk-for-net\sdk\core\Azure.Core.TestFramework\src\InstrumentClientInterceptor.cs
Covered lines:13
Uncovered lines:0
Coverable lines:13
Total lines:37
Line coverage:100% (13 of 13)
Covered branches:8
Total branches:8
Branch coverage:100% (8 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
Intercept(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Azure.Core.TestFramework\src\InstrumentClientInterceptor.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Castle.DynamicProxy;
 6
 7namespace Azure.Core.TestFramework
 8{
 9    internal class InstrumentClientInterceptor : IInterceptor
 10    {
 11        private readonly ClientTestBase _testBase;
 12
 6175713        public InstrumentClientInterceptor(ClientTestBase testBase)
 14        {
 6175715            _testBase = testBase;
 6175716        }
 17
 18        public void Intercept(IInvocation invocation)
 19        {
 12673420            invocation.Proceed();
 21
 12671322            var result = invocation.ReturnValue;
 12671323            if (result == null)
 24            {
 1242025                return;
 26            }
 27
 11429328            var type = result.GetType();
 11429329            if (type.Name.EndsWith("Client") ||
 11429330                // Generated ARM clients will have a property containing the subclient that ends with Operations.
 11429331                (invocation.Method.Name.StartsWith("get_") && type.Name.EndsWith("Operations")))
 32            {
 4017633                invocation.ReturnValue = _testBase.InstrumentClient(type, result, Array.Empty<IInterceptor>());
 34            }
 11429335        }
 36    }
 37}

Methods/Properties

.ctor(...)
Intercept(...)