示例#1
0
        public void Handle_InvalidJobOfferPropositionId_ThrowsNotFoundException()
        {
            //Arrange
            var handler = new UpdateJobOfferPropositionCommandHandler(_mapper, _logger.Object, _mockJobOfferPropositionRepository.Object);

            var command = new UpdateJobOfferPropositionCommand()
            {
                Id = "99"
            };

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

            //Assert
            func.ShouldThrowAsync <NotFoundException>();
        }
示例#2
0
        public async Task Handle_ValidJobOfferProposition_ReturnSpecyficType()
        {
            //Arrange
            var handler = new UpdateJobOfferPropositionCommandHandler(_mapper, _logger.Object, _mockJobOfferPropositionRepository.Object);

            var command = new UpdateJobOfferPropositionCommand()
            {
                Id      = "1",
                Content = "Updated 1"
            };

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

            //Assert
            result.ShouldBeOfType <Unit>();
        }
示例#3
0
        public async Task Handle_ValidJobOfferProposition_UpdatedToJobOfferPropositionRepository()
        {
            //Arrange
            var handler = new UpdateJobOfferPropositionCommandHandler(_mapper, _logger.Object, _mockJobOfferPropositionRepository.Object);

            var command = new UpdateJobOfferPropositionCommand()
            {
                Id      = "1",
                Content = "Updated 1"
            };

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

            var entity = await _mockJobOfferPropositionRepository.Object.GetByIdAsync(command.Id);

            //Assert
            entity.Content.ShouldBe("Updated 1");
        }