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" }); }
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" }); }
protected override void OnClose() { _worker.Dispose(); _worker = null; }