public async Task <IActionResult> UpdateCertificateWithReprintReason([FromBody] UpdateCertificateWithReprintReasonCommand command)
        {
            try
            {
                await _mediator.Send(command);
            }
            catch (NotFoundException)
            {
                throw new ResourceNotFoundException();
            }

            return(Ok());
        }
Ejemplo n.º 2
0
        public void WhenCalledWithInvalidCertificate_ThenThrowsNotFoundException(UpdateCertificateWithReprintReasonCommand command)
        {
            // Arrange
            var fixture = new UpdateCertificateWithReprintReasonCommandHandlerTestsFixture()
                          .WithCertificate(command.CertificateReference);

            command.OtherReason = string.Empty;

            // Act & Assert
            Assert.ThrowsAsync <NotFoundException>(async() => await
                                                   fixture.Handle(new UpdateCertificateWithReprintReasonCommand
            {
                CertificateReference = command.CertificateReference + "NotValid",
                IncidentNumber       = command.IncidentNumber,
                Reasons     = command.Reasons,
                OtherReason = command.OtherReason,
                Username    = command.Username
            }));
        }
Ejemplo n.º 3
0
        public async Task WhenCalledWithOtherReason_ThenUpdateIsCalled_ForCertificateReference(UpdateCertificateWithReprintReasonCommand command)
        {
            // Arrange
            var fixture = new UpdateCertificateWithReprintReasonCommandHandlerTestsFixture()
                          .WithCertificate(command.CertificateReference);

            command.OtherReason = "Some other reason";

            // Act
            await fixture.Handle(new UpdateCertificateWithReprintReasonCommand
            {
                CertificateReference = command.CertificateReference,
                IncidentNumber       = command.IncidentNumber,
                Reasons     = command.Reasons,
                OtherReason = command.OtherReason,
                Username    = command.Username
            });

            // Assert
            fixture.VerifyUpdateCalled(command.CertificateReference, command.IncidentNumber,
                                       command.Reasons, command.Username, CertificateActions.ReprintReason, command.OtherReason);
        }
Ejemplo n.º 4
0
 public async Task Handle(UpdateCertificateWithReprintReasonCommand command)
 {
     await _sut.Handle(command, new CancellationToken());
 }