コード例 #1
0
        /// <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);
        }
コード例 #2
0
		/// <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;
		}