예제 #1
0
        public async Task When_GetSpecificationJobs_has_no_jobs_Returns_OK()
        {
            _mockJobsApiClient
            .Setup(x => x.GetLatestJobsForSpecification("ABC123", new[] { "XXX", "YYY" }))
            .ReturnsAsync(new ApiResponse <IEnumerable <JobSummary> >(HttpStatusCode.NoContent, null));
            _sut = new JobsController(_mockJobsApiClient.Object, Mock.Of <IMapper>());

            IActionResult result = await _sut.GetSpecificationJobs("ABC123", "XXX,YYY");

            _mockJobsApiClient.VerifyAll();
            result.Should().NotBeNull();
            result.Should().BeAssignableTo <OkObjectResult>();
            var content = (result as OkObjectResult).Value;

            content.Should().NotBeNull();
        }
예제 #2
0
        public async Task When_GetSpecificationJobs_has_Valid_JobTypes_Returns_Jobs()
        {
            IEnumerable <JobSummary> expected = new List <JobSummary> {
                new JobSummary {
                    JobId = "ABC123", RunningStatus = RunningStatus.Queued
                }
            };

            _mockJobsApiClient
            .Setup(x => x.GetLatestJobsForSpecification("ABC123", new[] { "Published" }))
            .ReturnsAsync(new ApiResponse <IEnumerable <JobSummary> >(HttpStatusCode.OK, expected));
            _sut = new JobsController(_mockJobsApiClient.Object, Mock.Of <IMapper>());

            IActionResult result = await _sut.GetSpecificationJobs("ABC123", "Published");

            result.Should().NotBeNull();
            result.Should().BeAssignableTo <OkObjectResult>();
            var content = (result as OkObjectResult).Value;

            content.Should().NotBeNull();
            content.Should().BeOfType <JobSummaryViewModel[]>();
        }