Exemple #1
0
        public IHttpActionResult Delete(NotaFiscalDeleteCommand notaFiscal)
        {
            var validator = notaFiscal.Validar();

            if (!validator.IsValid)
            {
                return(HandleValidationFailure(validator.Errors));
            }
            return(HandleCallback(() => _notaFiscalService.Delete(notaFiscal)));
        }
        public void ApplService_NotaFiscal_Delete_Deve_Deletar_NotaFiscal()
        {
            //Arrange
            var nota = ObjectMother.NotaFiscalValidaParaDeletar;

            _notaFiscalRepository.Setup(x => x.Delete(nota.NotaFiscalIds[0])).Returns(true);

            //Action
            Action notaDeleteAction = () => _notaFiscalService.Delete(nota);

            //Assert
            notaDeleteAction.Should().NotThrow <Exception>();
            _notaFiscalRepository.Verify(x => x.Delete(nota.NotaFiscalIds[0]), Times.Once());
            _notaFiscalRepository.VerifyNoOtherCalls();
        }