public void ShouldReturnValidWhenEditCommandIsValid() { var command = new EditProfessorCommand(); command.Id = Guid.NewGuid(); command.FirstName = "FirstName"; command.LastName = "LastName"; command.Document = "402.020.980-44"; command.Email = "*****@*****.**"; command.IdCourse = Guid.NewGuid(); var handler = new ProfessorHandler(new ProfessorRepositoryMock(), new EmailServiceMock()); var result = handler.Handle(command); Assert.AreEqual(true, result.Status); }
public void Edit(EditProfessorCommand command) { _db.Connection().Execute( "spEditProfessor", new { id = command.Id, firstName = command.FirstName, lastName = command.LastName, document = command.Document, email = command.Email, phone = command.Phone, status = command.Status, idCourse = command.IdCourse }, commandType: CommandType.StoredProcedure ); }
public ICommandResult Handle(EditProfessorCommand command) { var name = new Name(command.FirstName, command.LastName); var email = new Email(command.Email); var document = new Document(command.Document); AddNotifications(name.Notifications); AddNotifications(email.Notifications); AddNotifications(document.Notifications); if (Invalid) { return(new CommandResult(false, "Erro ao editar professor", Notifications)); } _repository.Edit(command); _service.Send("*****@*****.**", email.Address, "Modificação", "Professor modificado com sucesso"); return(new CommandResult(true, "Professor modificado com sucesso", null)); }
public void Edit(EditProfessorCommand command) { }
public ICommandResult Put([FromBody] EditProfessorCommand command) { return(_handler.Handle(command)); }