Exemple #1
0
        public async Task ThenReturnsASingleCommitment(GetCommitmentResponse mediatorResponse)
        {
            _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetCommitmentRequest>())).ReturnsAsync(mediatorResponse);

            var result = await _controller.GetCommitment(111L, 3L) as OkNegotiatedContentResult <CommitmentView>;

            result.Content.Should().NotBeNull();
            _commitmentMapper.Verify(x => x.MapFrom(It.IsAny <Domain.Entities.Commitment>(), It.IsAny <CallerType>()),
                                     Times.Once);
        }
Exemple #2
0
        public async Task ThenReturnsNotFoundWhenOrchestratorReturnsNull()
        {
            var orchestrator = new Mock <IEmployerOrchestrator>();

            orchestrator.Setup(x => x.GetCommitment(It.IsAny <long>(), It.IsAny <long>())).ReturnsAsync((CommitmentView)null);
            var controller = new EmployerController(orchestrator.Object, Mock.Of <IApprenticeshipsOrchestrator>());

            var result = await controller.GetCommitment(1L, 1L);

            result.Should().BeOfType <NotFoundResult>();
        }