コード例 #1
0
 private FizzBuzzUnityController(UnityProxy <IQuestion> unityProxy) : this(unityProxy.Intercept(
                                                                               new FizzBuzz(unityProxy.Intercept(
                                                                                                new Buzz(unityProxy.Intercept(
                                                                                                             new Fizz(unityProxy.Intercept(
                                                                                                                          new Default())
                                                                                                                      )))))))
 {
 }
コード例 #2
0
        public void GivenRealPerformanceMonitorShouldInterceptAndLogEntry()
        {
            LogFake logFake = new LogFake();
            UnityProxy <IQuestion> unityProxy = new UnityProxy <IQuestion>(new PerformanceMonitor(logFake));

            IQuestion question = unityProxy.Intercept(new AopUnityFizzBuzzSpike.Questions.FizzBuzz());

            question.String(1);

            logFake.LogEntries.Count.Should().Be(1);
        }
コード例 #3
0
        public void GivenRealPerformanceMonitorShouldNotThrow()
        {
            UnityProxy <IQuestion> unityProxy = new UnityProxy <IQuestion>();

            Action action = () =>
            {
                IQuestion question = unityProxy.Intercept(new AopUnityFizzBuzzSpike.Questions.FizzBuzz());
                question.String(1);
            };

            action.ShouldNotThrow();
        }
コード例 #4
0
        public void GivenRealPerformanceMonitorWithApplicationInsightsLogShouldInterceptAndNotThrow()
        {
            UnityProxy <IQuestion> unityProxy = new UnityProxy <IQuestion>(new PerformanceMonitor(new ApplicationInsightsLog()));

            Action action = () =>
            {
                IQuestion question = unityProxy.Intercept(new AopUnityFizzBuzzSpike.Questions.FizzBuzz());
                question.String(1);
            };

            action.ShouldNotThrow();
        }
コード例 #5
0
        public void ShouldIntercept()
        {
            //arrange
            FakePerformanceMonitor fakePerformanceMonitor = new FakePerformanceMonitor();
            UnityProxy <IQuestion> unityProxy             = new UnityProxy <IQuestion>(fakePerformanceMonitor);

            //act
            IQuestion question = unityProxy.Intercept(new AopUnityFizzBuzzSpike.Questions.FizzBuzz());

            question.String(1);

            //assert
            fakePerformanceMonitor.AssertInvoked();
        }