Ejemplo n.º 1
0
        public void ShouldSendEventInfoToLogger()
        {
            var mockInvocation = Substitute.For <IInvocation>();

            mockInvocation.Method.Returns(
                MethodInfoUtil.GetMethodInfo <DummyObject>(x => x.SetValue(1)));
            mockInvocation.TargetType.Returns(typeof(DummyObject));

            _classUnderTest.Intercept(mockInvocation);
            _mockTraceLogger.Received().TraceEvent("SetValue", EventType.Sync, typeof(DummyObject),
                                                   Arg.Is <long>(1), Arg.Is <long>(1),
                                                   Arg.Any <int>());
        }
        public void BlockingUnaryCallSuccess()
        {
            string response = classUnderTest.BlockingUnaryCall(FakeRequest, context, (req, ctx) =>
            {
                Assert.AreEqual(context, ctx);
                Assert.AreEqual(FakeRequest, req);
                return(FakeResponse);
            });

            Assert.AreEqual(FakeResponse, response);
            mockTraceLogger.Received(1).TraceEvent(FakeMethodName, EventType.Sync,
                                                   FakeRequest.GetType(), expectedDurationUs,
                                                   expectedStartTimestampUs, Arg.Any <int>());
        }