/// <summary> /// Returns a mock background job client, which executes the given job immediately. /// </summary> private static Mock <IJobQueueClient> GetMockJobQueueClient( IProjectRunnerService projectRunnerService) { var jobQueueClient = new Mock <IJobQueueClient>(); jobQueueClient .Setup ( jqc => jqc.EnqueueAsync <IProjectRunnerService> ( It.IsAny <Expression <Func <IProjectRunnerService, Task> > >() ) ) .Callback <Expression <Func <IProjectRunnerService, Task> > > ( jobExpression => jobExpression.Compile()(projectRunnerService) ) .ReturnsAsync("BuildJobId"); return(jobQueueClient); }
/// <summary> /// Returns a mock background job client, which executes the given job immediately. /// </summary> private static Mock<IJobQueueClient> GetMockJobQueueClient( IProjectRunnerService projectRunnerService) { var jobQueueClient = new Mock<IJobQueueClient>(); jobQueueClient .Setup ( jqc => jqc.EnqueueAsync<IProjectRunnerService> ( It.IsAny<Expression<Func<IProjectRunnerService, Task>>>() ) ) .Callback<Expression<Func<IProjectRunnerService, Task>>> ( jobExpression => jobExpression.Compile()(projectRunnerService) ) .ReturnsAsync("BuildJobId"); return jobQueueClient; }