コード例 #1
0
        public void Should_be_able_to_dispose_failing_worker()
        {
            var worker = new TestProcessor();
            var target = new WorkerThread <int>("test", TimeSpan.FromDays(1), worker.Process);

            target.Enqueue(1);

            target.Dispose();

            worker.Logs.Should().Have.SameSequenceAs(new[] {
                "1"
            });
        }
コード例 #2
0
        public void Should_dequeue_all_when_disposing()
        {
            var worker = new TestProcessor();
            var target = new WorkerThread <int>("test", TimeSpan.FromDays(1), worker.Process);

            target.Enqueue(1);
            target.Enqueue(2);
            target.Enqueue(3);

            target.Dispose();

            worker.Logs.Should().Have.SameSequenceAs(new[] {
                "1, 2, 3"
            });
        }
コード例 #3
0
 protected override void OnClose()
 {
     _worker.Dispose();
     _worker = null;
 }