Beispiel #1
0
        public void ConstructingAThreadStatsSamplerShouldNotThrowAnError()
        {
            //This test was added because the AbstractSampler used to make a call to the virtual method Start in its .ctor,
            //which then invoked the overridden Start method in the child class before the child .ctor had a chance to
            //initialize its fields. This test helps with verifying that this problem doesn't happen again.
            var scheduler = Mock.Create <IScheduler>();
            var sampler   = new ThreadStatsSampler(scheduler, GetThreadEventsListener, _threadStatsSampleTransformer, new ThreadPoolStatic());

            sampler.Start();
        }
Beispiel #2
0
        public void SetUp()
        {
            _sampleAction       = null;
            _compositeTestAgent = new CompositeTestAgent();
            _compositeTestAgent.SetEventListenerSamplersEnabled(true);

            Mock.Arrange(() => _mockScheduler.ExecuteEvery(Arg.IsAny <Action>(), Arg.IsAny <TimeSpan>(), Arg.IsAny <TimeSpan?>()))
            .DoInstead <Action, TimeSpan, TimeSpan?>((action, _, __) => _sampleAction = action);
            _threadStatsSampleTransformer = Mock.Create <IThreadStatsSampleTransformer>();
            _threadEventsListener         = Mock.Create <ISampledEventListener <ThreadpoolThroughputEventsSample> >();
            _threadStatsSampler           = new ThreadStatsSampler(_mockScheduler, GetThreadEventsListener, _threadStatsSampleTransformer, new ThreadPoolStatic());
            _threadStatsSampler.Start();
        }