public async Task RegistrarComandaServiceTest() { int idComanda = 5; List <Pedido> pedidos = new List <Pedido>(); pedidos.Add(new Pedido() { Id = 1, Nome = "Cerveja", Preco = 5, Desconto = 2 }); pedidos.Add(new Pedido() { Id = 2, Nome = "Conhaque", Preco = 20 }); var repository = new Mock <IComandaRepository>(); repository.Setup(s => s.RegistrarComandaAsync(pedidos)) .Returns(Task.Run(() => idComanda)); var service = new ComandaService(repository.Object); var result = await service.RegistrarComandaAsync(pedidos); Assert.Equal(idComanda.ToString(), result.ToString()); }
public static void MostrarComandaResumida(int comandaId) { Console.WriteLine(); ViewPrinter.Println("\t DESCRICAO RESUMIDA DA COMANDA ", ConsoleColor.White, ConsoleColor.DarkGreen); var comanda = ComandaService.ObterComandaResumida(comandaId); ViewPrinter.Println("\t------------------------------------------------------"); ViewPrinter.Print("\tComanda: "); ViewPrinter.Print(comandaId.ToString(), ConsoleColor.Cyan); ViewPrinter.Print("\t\t\t\tMesa: "); ViewPrinter.Println($" [{ comanda.MesaId }] ", ConsoleColor.Blue, ConsoleColor.White); ViewPrinter.Println("\t------------------------------------------------------"); ViewPrinter.Print("\tValor atual: "); ViewPrinter.Print($" R$ { comanda.Valor.ToString("F2", CultureInfo.InvariantCulture) } ", ConsoleColor.DarkBlue, ConsoleColor.White); ViewPrinter.Print("\t Entrada: "); ViewPrinter.Println(comanda.DataHoraEntrada.ToString()); Console.WriteLine(); }
public ImplCarService() { var autoContext = new CarServiceContext(); var unitOfWork = new UnitOfWork(autoContext); var autoRepository = new Repository <Auto>(unitOfWork); var clientRepository = new Repository <Client>(unitOfWork); var comandaRepository = new Repository <Comanda>(unitOfWork); var detaliuComandaRepository = new Repository <DetaliuComanda>(unitOfWork); var imagineRepository = new Repository <Imagine>(unitOfWork); var materialRepository = new Repository <Material>(unitOfWork); var mecanicRepository = new Repository <Mecanic>(unitOfWork); var operatieRepository = new Repository <Operatie>(unitOfWork); var sasiuRepository = new Repository <Sasiu>(unitOfWork); clientService = new ClientService(clientRepository, unitOfWork); autoService = new AutoService(autoRepository, unitOfWork); comandaService = new ComandaService(comandaRepository, unitOfWork); detaliuComandaService = new DetaliuComandaService(detaliuComandaRepository, unitOfWork); imagineService = new ImagineService(imagineRepository, unitOfWork); materialService = new MaterialService(materialRepository, unitOfWork); mecanicService = new MecanicService(mecanicRepository, unitOfWork); operatieService = new OperatieService(operatieRepository, unitOfWork); sasiuService = new SasiuService(sasiuRepository, unitOfWork); }
public static void MostrarComandaCompleta(int comandaId) { MostrarAcompanhamento(comandaId, true); ViewPrinter.Println("\t--------------------------------------------------------", ConsoleColor.Cyan); ViewPrinter.Print("\tValor Final: "); ViewPrinter.Print($" R$ { ComandaService.CalcularValorComanda(comandaId, true).ToString("F2", CultureInfo.InvariantCulture) } ", ConsoleColor.White, ConsoleColor.Green); ViewPrinter.Print("\t * Incluído 10% garçom", ConsoleColor.Yellow); Console.WriteLine(); }
public async Task AbrirComandaServiceTest() { int idComanda = 5; var repository = new Mock <IComandaRepository>(); repository.Setup(s => s.AbrirComandaAsync()) .Returns(Task.Run(() => idComanda)); var service = new ComandaService(repository.Object); var result = await service.AbrirComandaAsync(); Assert.Equal(result, idComanda); }
public static bool ChamarOpcaoEscolhida(int comandaId, int opcaoEscolhida, int tipoExibicaoCardapio) { ViewPrinter.Print("\tOPCAO ESCOLHIDA: "); switch (opcaoEscolhida) { case 1: ViewPrinter.Println(" Fazer novo pedido ", ConsoleColor.White, ConsoleColor.DarkGreen); PressioneEnterParaContinuar("ir ao cardápio"); ViewPedido.MostrarCardapio(comandaId, tipoExibicaoCardapio); break; case 2: ViewPrinter.Println(" Cancelar um pedido ", ConsoleColor.White, ConsoleColor.DarkGreen); Console.WriteLine(); ViewPrinter.Println("\t Esta funcionalidade ainda não está operando ", ConsoleColor.Black, ConsoleColor.Yellow); break; case 3: ViewPrinter.Println(" Acompanhamento da comanda ", ConsoleColor.White, ConsoleColor.DarkGreen); PressioneEnterParaContinuar("visualizar o acompanhamento da comanda"); ViewComanda.MostrarAcompanhamento(comandaId); break; case 4: ViewPrinter.Println(" Encerrar comanda ", ConsoleColor.White, ConsoleColor.DarkGreen); PressioneEnterParaContinuar("prosseguir com encerramento da comanda"); bool encerrar = ViewComanda.EncerramentoComanda(comandaId); if (encerrar) { ComandaService.EncerrarComanda(comandaId); ViewPrinter.Println("\n\t COMANDA FINALIZADA COM SUCESSO! ", ConsoleColor.White, ConsoleColor.Green); PressioneEnterParaContinuar("encerrar o atendimento"); return(false); } break; default: ViewPrinter.Println(" Opcao escolhida invalida! ", ConsoleColor.White, ConsoleColor.Red); break; } Console.WriteLine(); MensagemContinuarAtendimento(); return(true); }
public async Task BuscarTodosPedidosServiceTest() { List <Pedido> pedidos = new List <Pedido>(); pedidos.Add(new Pedido() { Id = 1, Nome = "Cerveja", Preco = 5 }); var repository = new Mock <IComandaRepository>(); repository.Setup(s => s.BuscarPedidosAsync()) .Returns(Task.Run(() => pedidos)); var service = new ComandaService(repository.Object); var result = await service.BuscarTodosPedidosAsync(); Assert.NotNull(result); Assert.Equal(pedidos.Count.ToString(), result.Count.ToString()); }
public async Task GerarNotaFiscalServiceTest() { int idComanda = 5; List <Pedido> pedidos = new List <Pedido>(); pedidos.Add(new Pedido() { Id = 1, Nome = "Cerveja", Preco = 5 }); var repository = new Mock <IComandaRepository>(); repository.Setup(s => s.BuscarPedidoPorComandaAsync(idComanda)) .Returns(Task.Run(() => pedidos)); var service = new ComandaService(repository.Object); var nota = await service.GerarNotaFiscalAsync(idComanda); Assert.NotEqual(0, nota.TotalSemDesconto, 2); }
static void Main(string[] args) { Console.Clear(); ViewPrograma.Welcome(); Console.Clear(); // Solicitando dados iniciais Console.WriteLine(); ViewPrinter.Print("\tSEU ATENDIMENTO FOI INICIADO", ConsoleColor.Green); Console.WriteLine(); // Leitura e validacao ID Mesa ViewPrograma.CabecalhoDadosIniciais(); ViewMesa.LabelObterDadosMesa(); int mesaId = int.Parse(Console.ReadLine()); bool mesaDisponivel = MesaService.ValidarMesa(mesaId) && !MesaService.MesaOcupada(mesaId); if (!mesaDisponivel) { mesaId = ViewMesa.ObterMesaDisponivel(mesaId); } ViewMesa.MostrarMesaSelecionada(mesaId); Console.Clear(); // Leitura e validacao ID Comanda ViewPrograma.CabecalhoDadosIniciais(); ViewComanda.LabelObterDadosComanda(); int comandaId = int.Parse(Console.ReadLine()); // bool comandaExistente = !ComandaService.JaExisteComanda(comandaId); // if (!comandaExistente) comandaId = ViewComanda.ObterComandaValida(comandaId); ViewComanda.MostrarComandaSelecionada(comandaId); Console.Clear(); // Leitura e validacao Quantidade de Clientes ViewPrograma.CabecalhoDadosIniciais(); ViewMesa.LabelObterQuantidadeClientes(mesaId); int quantidadeClientes = int.Parse(Console.ReadLine()); bool quantidadeClientesValida = MesaService.QuantidadeClientesValida(mesaId, quantidadeClientes); if (!quantidadeClientesValida) { quantidadeClientes = ViewMesa.ObterQuantidadeClientesValida(mesaId, quantidadeClientes); } ViewMesa.MostrarQuantidadeClientesSelecionada(quantidadeClientes); Console.Clear(); // Criacao do modelo de comanda recebido via formulario var comanda = new ComandaFormularioModelCLI() { ComandaId = comandaId, MesaId = mesaId, QuantidadeCliente = quantidadeClientes }; int tipoExibicaoCardapio = ViewPrograma.EscolhaFormatoExibicaoCardapio(); Console.Clear(); // Salvando comanda no banco de dados ComandaService.RegistrarComanda(comanda); /* * // Mostrando comanda resumida antes de iniciar o loop principal do programa * ViewComanda.MostrarComandaResumida(comandaId); * * ViewPrograma.MensagemContinuarAtendimento(); */ // Executa um loop mostrando o menu principal enquanto nao for explicitamente encerrado ViewPrograma.MostrarMenu(comandaId, tipoExibicaoCardapio); }
public VendaController(VendaService vendaService, ComandaService comandaService) { _vendaService = vendaService; _comandaService = comandaService; }
public ComandaController(ComandaService comandaService, ClienteService clienteService) { _comandaService = comandaService; _clienteService = clienteService; }
public ComandaController(ComandaService ComandaService) { _ComandaService = ComandaService; }
public PagamentoController(PagamentoService PagamentoService, ComandaService ComandaService) { _PagamentoService = PagamentoService; _ComandaService = ComandaService; }
public static void MostrarAcompanhamento(int comandaId, bool comandaCompleta = false) { Console.WriteLine(); if (comandaCompleta) { ViewPrinter.Println("\t COMANDA DETALHADA ", ConsoleColor.White, ConsoleColor.DarkGreen); } else { ViewPrinter.Println("\t ACOMPANHAMENTO DA COMANDA ", ConsoleColor.White, ConsoleColor.DarkGreen); } var comanda = ComandaService.ObterComandaResumida(comandaId); ViewPrinter.Println("\t------------------------------------------------------"); ViewPrinter.Print("\tNº Comanda: "); ViewPrinter.Println(comandaId.ToString(), ConsoleColor.Cyan); ViewPrinter.Print("\tMesa: "); ViewPrinter.Println($" [{ comanda.MesaId }] ", ConsoleColor.Blue, ConsoleColor.White); ViewPrinter.Print("\tQuantidade de pessoas: "); ViewPrinter.Print(comanda.QuantidadeClientes.ToString(), ConsoleColor.Cyan); if (comanda.QuantidadeClientes == 1) { ViewPrinter.Println(" pessoa"); } else { ViewPrinter.Println(" pessoas"); } /*ViewPrinter.Print("\tTempo em atividade: "); * TimeSpan tempo = ComandaService.CalcularTempoAtividade(comandaId); * string strTempo = string.Join(':', tempo.Hours, tempo.Minutes, tempo.Seconds); * ViewPrinter.Println(strTempo, ConsoleColor.Cyan); */ ViewPrinter.Print("\tData/hora entrada: "); ViewPrinter.Println(comanda.DataHoraEntrada.ToString(), ConsoleColor.Cyan); ViewPrinter.Println("\t----------------------------------------------------------------"); ViewPrinter.Println("\tPedidos relacionados a esta comanda: "); var listaPedidos = PedidoService.ObterPedidosPorComanda(comandaId); Console.WriteLine(); ViewPrinter.Println("\t #ID - Qtde x Produto - Valor --- Status "); ViewPrinter.Println("\t----------------------------------------------------------------"); // Imprimindo os rodizios como pedidos ViewPrinter.Print($"\t # - "); ViewPrinter.Print($"{ comanda.QuantidadeClientes } x Rodízio - R$ { MesaService.ValorRodizio.ToString("F2", CultureInfo.InvariantCulture) } --- "); ViewPrinter.Println(" Ativo ", ConsoleColor.White, ConsoleColor.Green); if (listaPedidos.Count == 0) { Console.WriteLine(); ViewPrinter.Println("\t Ainda não há pedidos relacionados a esta comanda ", ConsoleColor.Black, ConsoleColor.Yellow); } else { listaPedidos.ForEach(pedido => { var produto = ProdutoService.ObterProduto(pedido.ProdutoId, false); var status = StatusService.ObterStatus(pedido.Status); ViewPrinter.Print($"\t { pedido.PedidoId } - "); ViewPrinter.Print($"{ pedido.Quantidade } x { produto.Nome } - "); if (produto.Valor == 0) { ViewPrinter.Print("INCLUSO"); } else { ViewPrinter.Print($"R$ { produto.Valor.ToString("F2", CultureInfo.InvariantCulture) }"); } ViewPrinter.Print(" --- "); switch (pedido.Status) { case 1: ViewPrinter.Print($" { status.Descricao } ", ConsoleColor.Black, ConsoleColor.Yellow); break; case 2: ViewPrinter.Print($" { status.Descricao } ", ConsoleColor.White, ConsoleColor.Red); break; case 3: ViewPrinter.Print($" { status.Descricao } ", ConsoleColor.White, ConsoleColor.Green); break; default: ViewPrinter.Print($" { status.Descricao } ", ConsoleColor.Black, ConsoleColor.Gray); break; } Console.WriteLine(); }); } ViewPrinter.Println("\t------------------------------------------------------", ConsoleColor.Cyan); ViewPrinter.Print("\tValor parcial da comanda: "); ViewPrinter.Print($" R$ { comanda.Valor.ToString("F2", CultureInfo.InvariantCulture) } ", ConsoleColor.DarkBlue, ConsoleColor.White); Console.WriteLine(); }