Exemplo n.º 1
0
        public void SetUp()
        {
            methodInfo     = MethodInfoUtil.GetMethodInfo <DummyObject>(x => x.SetValue(1));
            mockInvocation = Substitute.For <IInvocation>();
            mockInvocation.MethodInvocationTarget.Returns(methodInfo);

            fakeTimeSource = new MonotonicTimeSource();
            mockMethodInvocationRecorder = Substitute.For <IMethodInvocationRecorder>();
            metricsCollectionAspect      = new MetricsCollectionAspect(
                mockMethodInvocationRecorder, fakeTimeSource);
        }
        public virtual void SetupStepTimeMetrics(List <IInterceptor> apiAspects, IMetrics metrics)
        {
            var schedulerFactory = new EventScheduler.Factory();
            var timerFactory     = new Timer.Factory();

            var timer = timerFactory.Create();
            var debugEventAggregator =
                new BatchEventAggregator <DebugEventBatch, DebugEventBatchParams,
                                          DebugEventBatchSummary>(_minimumDebugEventBatchSeparationInMillis,
                                                                  schedulerFactory,
                                                                  timer);
            var debugEventRecorder = new DebugEventRecorder(debugEventAggregator, metrics);

            var timeSource = GetTimeSource();
            var metricsCollectionAspect =
                new MetricsCollectionAspect(debugEventRecorder, timeSource);

            apiAspects.Add(metricsCollectionAspect);
        }