public async Task AddJobLog_Called_ReturnsJobLog() { string jobId = "5678"; IJobsApiClient jobsApiClient = Substitute.For <IJobsApiClient>(); JobManagementResiliencePolicies policies = new JobManagementResiliencePolicies { JobsApiClient = Policy.NoOpAsync() }; IMessengerService messengerService = Substitute.For <IMessengerService>(); ILogger logger = Substitute.For <ILogger>(); JobLog jobLog = new JobLog { JobId = jobId }; ApiResponse <JobLog> jobLogApiResponse = new ApiResponse <JobLog>(HttpStatusCode.OK, jobLog); JobLogUpdateModel jobLogUpdateModel = new JobLogUpdateModel(); jobsApiClient .AddJobLog(jobId, jobLogUpdateModel) .Returns(jobLogApiResponse); JobManagement jobManagement = new JobManagement(jobsApiClient, logger, policies, messengerService); //Act JobLog result = await jobManagement.AddJobLog(jobId, jobLogUpdateModel); Assert.AreEqual(result, jobLog); await jobsApiClient .Received(1) .AddJobLog(jobId, jobLogUpdateModel); }