private void WaitForJobStateAndUpdatePriority(IJob job, JobState expectedJobState, int newPriority)
{
WaitForJob(job.Id, expectedJobState, (string id) => { });
job = _mediaContext.Jobs.Where(c => c.Id == job.Id).FirstOrDefault();
Assert.IsNotNull(job);
Assert.AreEqual(InitialJobPriority, job.Priority);
job.Priority = newPriority;
job.Update();
job = _mediaContext.Jobs.Where(c => c.Id == job.Id).FirstOrDefault();
Assert.IsNotNull(job);
Assert.AreEqual(newPriority, job.Priority, "Job Priority is not matching expected value");
}