public async Task Enqueue_VoidMethod_ShouldSucceed() { var testStore = new MemoryJobStore(); var jobManager = new JobManager(testStore); var jobRunner = new JobRunner(null !); await jobManager.EnqueueAsync(() => TestJobs.Job1(1)); JobDescriptor?job = await testStore.NextAsync(CancellationToken.None); Assert.Equal("Job1", job !.Call.Method); jobRunner.Invoke(job.Call, CancellationToken.None); }
public async Task Enqueue_AsyncInstanceMethod_ShouldSucceed() { var testServiceProvider = new TestServiceProvider(); var testStore = new MemoryJobStore(); var jobManager = new JobManager(testStore); var jobRunner = new JobRunner(testServiceProvider); await jobManager.EnqueueAsync <TestJobs>((t) => t.InstanceJobAsync1(1)); JobDescriptor?job = await testStore.NextAsync(CancellationToken.None); Assert.Equal("InstanceJobAsync1", job !.Call.Method); await jobRunner.InvokeAsync(job.Call, CancellationToken.None); }