public async Task GetNonCompletedJobsWithinTimeFrame_Called_ReturnsJobSummaries() { string jobId = "5678"; DateTimeOffset from = DateTimeOffset.UtcNow.AddDays(-2); DateTimeOffset to = DateTimeOffset.UtcNow.AddDays(-1); IJobsApiClient jobsApiClient = Substitute.For <IJobsApiClient>(); JobManagementResiliencePolicies policies = new JobManagementResiliencePolicies { JobsApiClient = Policy.NoOpAsync() }; IMessengerService messengerService = Substitute.For <IMessengerService>(); ILogger logger = Substitute.For <ILogger>(); JobSummary jobSummary = new JobSummary { JobId = jobId }; IEnumerable <JobSummary> jobSummaries = new List <JobSummary> { jobSummary }; ApiResponse <IEnumerable <JobSummary> > jobSummariesApiResponse = new ApiResponse <IEnumerable <JobSummary> >(HttpStatusCode.OK, jobSummaries); jobsApiClient .GetNonCompletedJobsWithinTimeFrame(from, to) .Returns(jobSummariesApiResponse); JobManagement jobManagement = new JobManagement(jobsApiClient, logger, policies, messengerService); //Act IEnumerable <JobSummary> result = await jobManagement.GetNonCompletedJobsWithinTimeFrame(from, to); Assert.AreEqual(result, jobSummaries); await jobsApiClient .Received(1) .GetNonCompletedJobsWithinTimeFrame(from, to); }