/// <summary>
        /// OnAsyncMethodEnd callback
        /// </summary>
        /// <typeparam name="TTarget">Type of the target</typeparam>
        /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
        /// <param name="returnValue">Return value</param>
        /// <param name="exception">Exception instance in case the original code threw an exception.</param>
        /// <param name="state">Calltarget state value</param>
        /// <returns>A response value, in an async scenario will be T of Task of T</returns>
        public static decimal OnAsyncMethodEnd <TTarget>(TTarget instance, decimal returnValue, Exception exception, CallTargetState state)
        {
            Scope scope = state.Scope;

            if (scope != null)
            {
                TestInvokerStruct invokerInstance = instance.As <TestInvokerStruct>();
                XUnitIntegration.FinishScope(scope, invokerInstance.Aggregator);
            }

            return(returnValue);
        }
        /// <summary>
        /// OnMethodBegin callback
        /// </summary>
        /// <typeparam name="TTarget">Type of the target</typeparam>
        /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
        /// <returns>Calltarget state value</returns>
        public static CallTargetState OnMethodBegin <TTarget>(TTarget instance)
        {
            if (!Tracer.Instance.Settings.IsIntegrationEnabled(IntegrationName))
            {
                return(CallTargetState.GetDefault());
            }

            TestRunnerStruct runnerInstance = instance.As <TestRunnerStruct>();

            // Skip test support
            if (runnerInstance.SkipReason != null)
            {
                XUnitIntegration.CreateScope(ref runnerInstance, instance.GetType());
            }

            return(CallTargetState.GetDefault());
        }
        /// <summary>
        /// OnMethodBegin callback
        /// </summary>
        /// <typeparam name="TTarget">Type of the target</typeparam>
        /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
        /// <returns>Calltarget state value</returns>
        public static CallTargetState OnMethodBegin <TTarget>(TTarget instance)
        {
            if (!Tracer.Instance.Settings.IsIntegrationEnabled(IntegrationName))
            {
                return(CallTargetState.GetDefault());
            }

            TestInvokerStruct invokerInstance = instance.As <TestInvokerStruct>();
            TestRunnerStruct  runnerInstance  = new TestRunnerStruct
            {
                Aggregator          = invokerInstance.Aggregator,
                TestCase            = invokerInstance.TestCase,
                TestClass           = invokerInstance.TestClass,
                TestMethod          = invokerInstance.TestMethod,
                TestMethodArguments = invokerInstance.TestMethodArguments
            };

            return(new CallTargetState(XUnitIntegration.CreateScope(ref runnerInstance, instance.GetType())));
        }