Esempio n. 1
0
        public void TestIntercept()
        {
            var mockLoggingService = new Mock <ILoggingService>();
            var args = new MethodExecutionArgs(null, Arguments.Empty);

            ObjectFactory.Initialize(x => x.For <ILoggingService>().Use(mockLoggingService.Object));
            var loggingAspect = new MyLoggingAspect();

            loggingAspect.RuntimeInitialize(null);

            loggingAspect.OnEntry(args);
            loggingAspect.OnSuccess(args);

            mockLoggingService.Verify(x => x.Write("Log start"));
            mockLoggingService.Verify(x => x.Write("Log end"));
        }
Esempio n. 2
0
        public void TestIntercept()
        {
            var mockLoggingService = new Mock<ILoggingService>();
            var args = new MethodExecutionArgs(null, Arguments.Empty);

            ObjectFactory.Initialize(x => x.For<ILoggingService>().Use(mockLoggingService.Object));
            var loggingAspect = new MyLoggingAspect();
            loggingAspect.RuntimeInitialize(null);

            loggingAspect.OnEntry(args);
            loggingAspect.OnSuccess(args);

            mockLoggingService.Verify(x => x.Write("Log start"));
            mockLoggingService.Verify(x => x.Write("Log end"));
        }