public CommandResult Update( [FromBody] UpdateAlunoCommand command, [FromServices] AlunoHandler handler ) { return((CommandResult)handler.Handle(command)); }
public void InvalidHandler() { var command = new UpdateAlunoCommand("", "", DateTime.Now, "", ""); var handler = new AlunoHandler(new FakeAlunoRepository()); var result = (CommandResult)handler.Handle(command); Assert.AreEqual(result.Sucess, false); }
public void ValidHandler() { var command = new CreateAlunoCommand("Antonio Fracisco da Silva", "00000000000", DateTime.Now, "*****@*****.**", "0124"); var handler = new AlunoHandler(new FakeAlunoRepository()); var result = (CommandResult)handler.Handle(command); Assert.AreEqual(result.Sucess, true); }
public CommandResult Create( [FromBody] CreateAlunoCommand command, [FromServices] AlunoHandler handler ) { //Gravando o usuário token da google command.RefUser = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; return((CommandResult)handler.Handle(command)); }
public void ValidHandler() { //repository List <Aluno> listFakeAlunos = new List <Aluno>(); listFakeAlunos.Add( new Aluno() { Nome = "Antonio Fracisco da Silva", CPF = "00000000000", Nascimento = DateTime.Now, Email = "*****@*****.**", RefUser = "******" }); //update Aluno var commandUpdate = new UpdateAlunoCommand("Antonio Fracisco da Silva Segundo", "00000000000", DateTime.Now, "*****@*****.**", "01234"); var handler = new AlunoHandler(new FakeAlunoRepository(listFakeAlunos)); var resultUpdate = (CommandResult)handler.Handle(commandUpdate); Assert.AreEqual(resultUpdate.Sucess, true); }
public AlunoController(IAlunoRepositorio serieRepositorio, AlunoHandler alunoHandler, IUnitOfWorkRepositorio unitOfWork) : base(unitOfWork) { this._alunoRepositorio = serieRepositorio; this._alunoHandler = alunoHandler; }
public ImportarExcelController(IAlunoRepositorio serieRepositorio, AlunoHandler alunoHandler, FuncionarioHandler funcionarioHandler, IUnitOfWorkRepositorio unitOfWork) : base(unitOfWork) { this._alunoRepositorio = serieRepositorio; this._alunoHandler = alunoHandler; this._funcionarioHandler = funcionarioHandler; }