コード例 #1
0
            public void ExecuteAddsDurationToResult()
            {
                MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method;
                timerDecorator = new TimerDecorator(new StressTestRunner());

                var result = timerDecorator.Execute(method);

                Assert.True(result.Duration > 0);
            }
コード例 #2
0
            public void ExecuteAddsDurationToResult()
            {
                MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method;

                timerDecorator = new TimerDecorator(new StressTestRunner());

                var result = timerDecorator.Execute(method);

                Assert.True(result.Duration > 0);
            }
コード例 #3
0
            public void DecoratedTestRunnerRunsMethod()
            {
                timerDecorator = new TimerDecorator(testRunnerMock.Object);
                bool methodRun = false;
                MethodInfo method = ((Action)(() => methodRun = true)).Method;
                testRunnerMock
                    .Setup(x => x.Execute(method))
                    .Callback(() => methodRun = true)
                    .Returns(new TestResult());

                timerDecorator.Execute(method);

                Assert.True(methodRun);
            }
コード例 #4
0
            public void DecoratedTestRunnerRunsMethod()
            {
                timerDecorator = new TimerDecorator(testRunnerMock.Object);
                bool       methodRun = false;
                MethodInfo method    = ((Action)(() => methodRun = true)).Method;

                testRunnerMock
                .Setup(x => x.Execute(method))
                .Callback(() => methodRun = true)
                .Returns(new TestResult());

                timerDecorator.Execute(method);

                Assert.True(methodRun);
            }