< Summary

Information
Class: Ice.Internal.ObserverHelper
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/Internal/ObserverHelper.cs
Tag: 71_18251537082
Line coverage
94%
Covered lines: 16
Uncovered lines: 1
Coverable lines: 17
Total lines: 45
Line coverage: 94.1%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage
75%
Covered methods: 3
Total methods: 4
Method coverage: 75%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get(...)100%44100%
get(...)100%210%
get(...)100%66100%
.cctor()100%11100%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/Internal/ObserverHelper.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using Ice.Instrumentation;
 4
 5namespace Ice.Internal;
 6
 7public sealed class ObserverHelper
 8{
 9    public static InvocationObserver get(Instance instance, string op)
 10    {
 111        CommunicatorObserver obsv = instance.initializationData().observer;
 112        if (obsv != null)
 13        {
 114            InvocationObserver observer = obsv.getInvocationObserver(null, op, _emptyContext);
 115            observer?.attach();
 116            return observer;
 17        }
 118        return null;
 19    }
 20
 021    public static InvocationObserver get(Ice.ObjectPrx proxy, string op) => get(proxy, op, null);
 22
 23    public static InvocationObserver get(Ice.ObjectPrx proxy, string op, Dictionary<string, string> context)
 24    {
 125        CommunicatorObserver obsv =
 126            ((Ice.ObjectPrxHelperBase)proxy).iceReference().getInstance().initializationData().observer;
 127        if (obsv != null)
 28        {
 29            InvocationObserver observer;
 130            if (context == null)
 31            {
 132                observer = obsv.getInvocationObserver(proxy, op, _emptyContext);
 33            }
 34            else
 35            {
 136                observer = obsv.getInvocationObserver(proxy, op, context);
 37            }
 138            observer?.attach();
 139            return observer;
 40        }
 141        return null;
 42    }
 43
 144    private static readonly Dictionary<string, string> _emptyContext = new Dictionary<string, string>();
 45}