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 void SetUp() { mockTraceLogger = Substitute.For <ITracingLogger>(); method = new Method <string, string>(MethodType.Unary, FakeServiceName, FakeMethodName, Marshallers.StringMarshaller, Marshallers.StringMarshaller); context = new ClientInterceptorContext <string, string>(method, FakeHost, new CallOptions()); fakeTimeSource = new MonotonicTimeSource(); expectedStartTimestampTicks = fakeTimeSource.TimestampTicks + MonotonicTimeSource.TicksPerUs; expectedEndTimestampTicks = expectedStartTimestampTicks + MonotonicTimeSource.TicksPerUs; expectedStartTimestampUs = fakeTimeSource.ConvertTicksToUs(expectedStartTimestampTicks); expectedDurationUs = fakeTimeSource.GetDurationUs( expectedStartTimestampTicks, expectedEndTimestampTicks); classUnderTest = new TracingGrpcInterceptor(mockTraceLogger, fakeTimeSource); }
public void SetUp() { _mockTraceLogger = Substitute.For <ITracingLogger>(); _fakeTimeSource = new MonotonicTimeSource(); _classUnderTest = new TracingAspect(_mockTraceLogger, _fakeTimeSource); }