Exemple #1
0
        public void Start_ActionWithException_IsNotRethrow()
        {
            var logger = Substitute.For <ILogger <SpanProcessorTask> >();
            var config = new ZipkinConfig(new Uri("http://localhost"))
            {
                SpanProcessorBatchSize = 10
            };

            var sp = new SpanProcessorTask(config, logger);

            Assert.DoesNotThrow(() => sp.Start(() => Task.Run(() => { throw new Exception(); })));
            sp.Stop();
        }
Exemple #2
0
        public void Start_NullAction_IsNotRunning()
        {
            var logger = Substitute.For <ILogger <SpanProcessorTask> >();
            var config = new ZipkinConfig(new Uri("http://localhost"))
            {
                SpanProcessorBatchSize = 10
            };

            var sp = new SpanProcessorTask(config, logger);

            sp.Start(null);

            Assert.IsFalse(sp.IsRunning);
        }
Exemple #3
0
        public void Start_StoppedProcessor_ActionIsNotCalled()
        {
            var isExecute = false;
            var logger    = Substitute.For <ILogger <SpanProcessorTask> >();
            var config    = new ZipkinConfig(new Uri("http://localhost"))
            {
                SpanProcessorBatchSize = 10
            };

            var sp = new SpanProcessorTask(config, logger);

            sp.Stop();
            sp.Start(() => Task.Run(() => isExecute = true));

            Assert.IsFalse(isExecute);
        }
Exemple #4
0
        public void Start_Action_IsExecuting()
        {
            var isExecute = false;
            var logger    = Substitute.For <ILogger <SpanProcessorTask> >();
            var config    = new ZipkinConfig(new Uri("http://localhost"))
            {
                SpanProcessorBatchSize = 10
            };

            var sp = new SpanProcessorTask(config, logger);

            sp.Start(() => Task.Run(() => isExecute = true));

            Thread.Sleep(200);

            sp.Stop();

            Assert.IsTrue(isExecute);
        }