Esempio n. 1
0
        public override void OnExit(MethodExecutionArgs eventArgs)
        {
            if (Configuration.IsPlayback())
            {
                return;
            }

            RecordingServices.Recorder.RecordExit((Guid)eventArgs.MethodExecutionTag, eventArgs.Arguments.ToArray(), eventArgs.ReturnValue);
            RecordingStack.Pop();
        }
Esempio n. 2
0
        public override void OnEntry(MethodExecutionArgs eventArgs)
        {
            if (Configuration.IsPlayback())
            {
                return;
            }

            var callGuid = Guid.NewGuid();

            eventArgs.MethodExecutionTag = callGuid;
            RecordingServices.Recorder.RecordEntry(callGuid, eventArgs.Method, eventArgs.Instance, eventArgs.Arguments.ToArray());

            RecordingStack.Push(callGuid);
        }
Esempio n. 3
0
 public override void OnInvoke(MethodInterceptionArgs eventArgs)
 {
     if (Configuration.IsRecording())
     {
         eventArgs.Proceed();
         if (RecordingStack.Count > 0)
         {
             Guid callGuid = RecordingStack.Peek();
             RecordingServices.Recorder.RecordDependency(callGuid, eventArgs.Instance, (MethodInfo)eventArgs.Method, eventArgs.ReturnValue);
         }
     }
     else
     {
         if (RecordingServices.DependencyPlayback.HasReturnValue((MethodInfo)eventArgs.Method))
         {
             eventArgs.ReturnValue = RecordingServices.DependencyPlayback.GetReturnValue((MethodInfo)eventArgs.Method);
         }
         else
         {
             eventArgs.Proceed();
         }
     }
 }