public ResponsavelControllerTests()
        {
            this.mockResponsavelService = new Mock <IResponsavelService>();
            this.mockApiResultHandler   = new Mock <IApiResultHandler>();
            this.mockLogger             = new Mock <ILogger <ResponsavelController> >();

            this.sut = new ResponsavelController(
                this.mockApiResultHandler.Object,
                this.mockResponsavelService.Object,
                this.mockLogger.Object);

            this.sut.ControllerContext = new ControllerContext()
            {
                HttpContext = MockHelpers.CreateHttpContextMock()
            };

            this.criarResponsavelCommand = new CriarResponsavelCommand
            {
                Nome  = "Nome",
                Cpf   = "Cpf",
                Email = "Email",
                Foto  = new byte[1]
            };

            this.atualizarResponsavelCommand = new AtualizarResponsavelCommand
            {
                Id    = 1,
                Nome  = "Nome",
                Cpf   = "Cpf",
                Email = "Email",
                Foto  = new byte[1]
            };
        }
예제 #2
0
        public ResponsavelServiceTests()
        {
            this.mockMediator = new Mock <IMediator>();

            this.criarResponsavelCommand = new CriarResponsavelCommand
            {
                Nome  = "Nome",
                Cpf   = "Cpf",
                Email = "Email",
                Foto  = new byte[1]
            };

            this.atualizarResponsavelCommand = new AtualizarResponsavelCommand
            {
                Id    = 1,
                Nome  = "Nome",
                Cpf   = "Cpf",
                Email = "Email",
                Foto  = new byte[1]
            };

            this.sut = new ResponsavelService(this.mockMediator.Object);
        }
        public AtualizarResponsavelCommandHandlerTests()
        {
            this.mockResponsavelRepository = new Mock <IResponsavelRepository>();
            this.mockNotificationContext   = new Mock <INotificationContext>();
            this.mockValidator             = new Mock <IAtualizarResponsavelCommandValidator>();
            this.mockUnitOfWork            = new Mock <IUnitOfWork>();
            this.mockLogger = new Mock <ILogger <AtualizarResponsavelCommandHandler> >();

            this.command = new AtualizarResponsavelCommand
            {
                Id    = 1,
                Nome  = "Kelvin",
                Cpf   = "602.346.080-13",
                Email = "*****@*****.**",
                Foto  = new byte[1]
            };

            this.sut = new AtualizarResponsavelCommandHandler(
                this.mockResponsavelRepository.Object,
                this.mockNotificationContext.Object,
                this.mockValidator.Object,
                this.mockUnitOfWork.Object,
                this.mockLogger.Object);
        }
 public Task <IActionResult> AtualizarResponsavelAsync(int?id, [FromBody] AtualizarResponsavelCommand command)
 {
     command.Id = id;
     return(this.ExecAndHandleAsync(action: () => this.responsavelService.AtualizarResponsavelAsync(command)));
 }
 public async Task AtualizarResponsavelAsync(AtualizarResponsavelCommand command)
 {
     await this.mediator.Send(command);
 }