public void when_creating_job_then_can_cancel_it()
        {
            job.Resume();
            job.Cancel();

            Assert.Equal(DownloadStatus.Cancelled, job.Status);
        }
        public async Task when_resuming_job_then_gets_resumed_event()
        {
            var called = false;

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

            job.Resume();

            await Task.Run(() => {
                while (!called)
                {
                    Thread.Sleep(50);
                }
            }).TimeoutAfter(20);

            Assert.True(called);
        }
        public async Task when_finding_created_job_then_can_resume_and_finish()
        {
            job = manager.FindJob(job.Id);

            job.Resume();

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

            Assert.Equal(DownloadStatus.Transferred, job.Status);
        }