public void WarmupSessionHandler_Execute()
        {
            var task    = new Task(() => Thread.Sleep(TimeSpan.FromSeconds(0.5)));
            var handler = new WarmupSessionHandler();

            var result = handler.Execute(task, new ProfilerSettings {
                Iterations = 10
            });

            Assert.That(result.Warmup().Ticks > 0);
        }
        public void WarmupSessionHandler_Execute_EnsureTaskIsRun()
        {
            var settings = new ProfilerSettings {
                Iterations = 10
            };

            var task    = new Mock <ITask>();
            var handler = new WarmupSessionHandler();

            var result = handler.Execute(task.Object, settings);

            task.Verify(exp => exp.Run(It.IsAny <IExecutionContext>()), Times.Once);
        }
        public void WarmupSessionHandler_Execute_EnsureBaseIsCalled()
        {
            var next = new Mock <ISessionHandler>();

            next.Setup(exp => exp.Execute(It.IsAny <ITask>(), It.IsAny <ProfilerSettings>())).Returns(() => new ProfilerResult());

            var settings = new ProfilerSettings {
                Iterations = 10
            };

            var task    = new Task(() => Thread.Sleep(TimeSpan.FromSeconds(0.5)));
            var handler = new WarmupSessionHandler();

            handler.SetNext(next.Object);

            var result = handler.Execute(task, settings);

            next.Verify(exp => exp.Execute(task, settings), Times.Once);
        }