public async Task DeletePhotoCache() { var completeInfo = new TaskCompleteInfo(TaskType.ClearCache, "wdavidsen", true); _photoData.Setup(m => m.DeletePhotos()); _fileSystemService.Setup(m => m.DeleteDirectoryFiles(It.IsAny <string>(), It.IsAny <bool>())); await _photoService.DeletePhotoCache(completeInfo.ContextUserName); try { var token = new CancellationTokenSource().Token; var workItem = await _backgroundQueue.DequeueAsync(token); await workItem(token, new QueueEvents { ItemProcessed = (info) => { } }); } catch (TaskCanceledException) { } _photoData.Verify(m => m.DeletePhotos(), Times.Once); _fileSystemService.Verify(m => m.DeleteDirectoryFiles(It.IsAny <string>(), It.IsAny <bool>()), Times.Once); }