public void Dado_um_CreateReservaCommand_sem_ingressos_a_reserva_nao_deve_ser_criada() { var sessao = _sessaoRepository.GetById(Guid.NewGuid()); var poltronas = sessao.Poltrona.ToList(); var ingressos = new List <CreateIngressoCommand>(); var cliente = _clientRepository.GetById(Guid.NewGuid()); var command = new CreateReservaCommand(cliente.Id, sessao.Id, ingressos); var commandResult = (GenericCommandResult)_handler.Handle(command); Assert.IsFalse(commandResult.Sucess); Assert.AreEqual(_reservaRepository.GetByCliente(cliente.Id).Count(), 0); }
public void Dado_um_CreateReservaCommand_com_cliente_que_nao_existe_a_reserva_nao_deve_ser_criada() { var sessao = _sessaoRepository.GetById(Guid.NewGuid()); var poltronas = sessao.Poltrona.ToList(); var ingressos = new List <CreateIngressoCommand>() { new CreateIngressoCommand("Jose", poltronas[0].Id) }; var command = new CreateReservaCommand(Guid.Empty, sessao.Id, ingressos); var commandResult = (GenericCommandResult)_handler.Handle(command); Assert.IsFalse(commandResult.Sucess); }
public void Dado_um_CreateReservaCommand_valido_a_reserva_deve_ser_criada() { var sessao = _sessaoRepository.GetById(Guid.NewGuid()); var poltronas = sessao.Poltrona.ToList(); var ingressos = new List <CreateIngressoCommand>() { new CreateIngressoCommand("Jose", poltronas[0].Id), new CreateIngressoCommand("Amanda", poltronas[1].Id), new CreateIngressoCommand("Erika", poltronas[2].Id) }; var command = new CreateReservaCommand(Guid.NewGuid(), sessao.Id, ingressos); var commandResult = (GenericCommandResult)_handler.Handle(command); Assert.IsTrue(commandResult.Sucess); }
public static IEnumerable <Guid> Extract(CreateReservaCommand command) { return(command.Ingressos.Select(ingresso => ingresso.PoltronaId)); }