public async Task when_completing_job_then_gets_completed_event()
        {
            var called = false;

            job.Completed += (sender, args) => called = true;

            job.Resume();

            await Task.Run(() => {
                while (job.Status != DownloadStatus.Transferred)
                {
                    Thread.Sleep(50);
                }
            }).TimeoutAfter(60);

            job.Complete();

            Assert.True(called);
        }
        public async Task when_finding_created_job_then_can_find_it_completed_and_acknowledge_it()
        {
            job.Resume();
            await Task.Run(() => {
                while (job.Status != DownloadStatus.Transferred)
                {
                    Thread.Sleep(50);
                }
            }).TimeoutAfter(20);

            job = manager.FindJob(job.Id);
            Assert.Equal(DownloadStatus.Transferred, job.Status);

            job.Complete();

            Assert.Equal(DownloadStatus.Acknowledged, job.Status);

            // From now on, finding returns null.
            Assert.Null(manager.FindJob(job.Id));
        }