Table of Contents

Class JobsWaitHelpers

Namespace
Cratis.Chronicle.InProcess.Integration
Assembly
Cratis.Chronicle.dll

Helper methods for working with jobs for integration testing purposes.

public static class JobsWaitHelpers
Inheritance
JobsWaitHelpers
Inherited Members

Remarks

These are useful for integration tests where you want to ensure that a job has reached a certain state.

Methods

WaitForThereToBeJobs(IJobs, TimeSpan?)

Waits for there to be jobs in the system.

public static Task<IEnumerable<Job>> WaitForThereToBeJobs(this IJobs jobs, TimeSpan? timeout = null)

Parameters

jobs IJobs

IJobs system.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

Returns

Task<IEnumerable<Job>>

Awaitable task.

WaitForThereToBeNoJobs(IJobs, TimeSpan?, params JobStatus[])

Waits for there to be no jobs in the system.

public static Task<IEnumerable<Job>> WaitForThereToBeNoJobs(this IJobs jobs, TimeSpan? timeout = null, params JobStatus[] includeStatuses)

Parameters

jobs IJobs

IJobs system.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

includeStatuses JobStatus[]

Optional job statuses to include in the check. Defaults to all statuses.

Returns

Task<IEnumerable<Job>>

Awaitable task.

WaitTillJobIsDeleted(IJobs, JobId, TimeSpan?)

Waits for a job to be deleted.

public static Task WaitTillJobIsDeleted(this IJobs jobs, JobId jobId, TimeSpan? timeout = null)

Parameters

jobs IJobs

IJobs system.

jobId JobId

Job ID.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

Returns

Task

Awaitable task.

WaitTillJobMeetsPredicate(IJobs, JobId, Func<Job, bool>, TimeSpan?)

Waits for a job to reach a certain state based on a predicate.

public static Task<Job> WaitTillJobMeetsPredicate(this IJobs jobs, JobId jobId, Func<Job, bool> predicate, TimeSpan? timeout = null)

Parameters

jobs IJobs

IJobs system.

jobId JobId

Job ID.

predicate Func<Job, bool>

Predicate to check the job state.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

Returns

Task<Job>

Awaitable task.

WaitTillJobProgressCompleted(IJobs, JobId, TimeSpan?)

Waits for a job to be completed.

public static Task<Job> WaitTillJobProgressCompleted(this IJobs jobs, JobId jobId, TimeSpan? timeout = null)

Parameters

jobs IJobs

IJobs system.

jobId JobId

Job ID.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

Returns

Task<Job>

Awaitable task.

WaitTillJobProgressStopped(IJobs, JobId, TimeSpan?)

Waits for a job to be stopped.

public static Task<Job> WaitTillJobProgressStopped(this IJobs jobs, JobId jobId, TimeSpan? timeout = null)

Parameters

jobs IJobs

IJobs system.

jobId JobId

Job ID.

timeout TimeSpan?

Optional timeout. Defaults to 5 seconds.

Returns

Task<Job>

Awaitable task.