using System; using System.Threading.Tasks; using Shouldly; using Xunit; namespace Volo.Abp.BackgroundJobs { public class BackgroundJobManager_Tests : BackgroundJobsTestBase { private readonly IBackgroundJobManager _backgroundJobManager; private readonly IBackgroundJobStore _backgroundJobStore; public BackgroundJobManager_Tests() { _backgroundJobManager = GetRequiredService(); _backgroundJobStore = GetRequiredService(); } [Fact] public async Task Should_Store_Jobs() { var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyJobArgs("42")); jobIdAsString.ShouldNotBe(default); (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); } [Fact] public async Task Should_Store_Async_Jobs() { var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42")); jobIdAsString.ShouldNotBe(default); (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); } } }