コード例 #1
0
 public CommandResult Update(
     [FromBody] UpdateAlunoCommand command,
     [FromServices] AlunoHandler handler
     )
 {
     return((CommandResult)handler.Handle(command));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 public AlunoController(IAlunoRepositorio serieRepositorio, AlunoHandler alunoHandler, IUnitOfWorkRepositorio unitOfWork) : base(unitOfWork)
 {
     this._alunoRepositorio = serieRepositorio;
     this._alunoHandler     = alunoHandler;
 }
コード例 #7
0
 public ImportarExcelController(IAlunoRepositorio serieRepositorio, AlunoHandler alunoHandler, FuncionarioHandler funcionarioHandler, IUnitOfWorkRepositorio unitOfWork) : base(unitOfWork)
 {
     this._alunoRepositorio   = serieRepositorio;
     this._alunoHandler       = alunoHandler;
     this._funcionarioHandler = funcionarioHandler;
 }