Beispiel #1
0
        public void Handle_InvalidJobOfferPropositionId_ThrowsNotFoundException()
        {
            //Arrange
            var handler = new CreateJobOfferPropositionCommandHandler(_mockJobOfferRepository.Object, _mapper, _logger.Object, _mockJobOfferPropositionRepository.Object, _mockUriService.Object);

            var command = new CreateJobOfferPropositionCommand()
            {
                JobOfferId = "99"
            };

            //Act
            Func <Task> func = () => handler.Handle(command, CancellationToken.None);

            //Assert
            func.ShouldThrowAsync <NotFoundException>();
        }
Beispiel #2
0
        public async Task Handle_ValidJobOfferProposition_ReturnsSpecyficType()
        {
            //Arrange
            var handler = new CreateJobOfferPropositionCommandHandler(_mockJobOfferRepository.Object, _mapper, _logger.Object, _mockJobOfferPropositionRepository.Object, _mockUriService.Object);

            var command = new CreateJobOfferPropositionCommand()
            {
                Content    = "JobOfferProposition 1",
                JobOfferId = "1"
            };

            //Act
            var result = await handler.Handle(command, CancellationToken.None);

            //Assert
            result.ShouldBeOfType <CreateJobOfferPropositionCommandResponse>();
        }
Beispiel #3
0
        public async Task Handle_ValidJobOfferProposition_AddedToJobOfferPropositionRepository()
        {
            //Arrange
            var handler = new CreateJobOfferPropositionCommandHandler(_mockJobOfferRepository.Object, _mapper, _logger.Object, _mockJobOfferPropositionRepository.Object, _mockUriService.Object);

            var command = new CreateJobOfferPropositionCommand()
            {
                Content    = "JobOfferProposition 1",
                JobOfferId = "1"
            };

            var itemsCountBefore = (await _mockJobOfferPropositionRepository.Object.GetAllAsync()).Count;

            //Act
            await handler.Handle(command, CancellationToken.None);

            var itemsCountAfter = (await _mockJobOfferPropositionRepository.Object.GetAllAsync()).Count;

            //Assert
            itemsCountAfter.ShouldBe(itemsCountBefore + 1);
        }