public void DadoUmComandoInvalidoNaoGeraVenda() { var command = new GeraVendaCommand(new Usuario(null, null)); var handler = new GeraVendaHandler(new FakeRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Sucesso, false); }
public void DadoUmComandoValidoGeraVenda() { var command = new GeraVendaCommand(new Usuario("Daniel", "123456")); var handler = new GeraVendaHandler(new FakeRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Sucesso, true); }
public GeraVendaCommandTests() { _vendaCommand = new GeraVendaCommand(_usuario); _vi1 = new VendaItem(_p1, 10); _vi2 = new VendaItem(_p2, 10); _vi3 = new VendaItem(_p3, 10); _vi4 = new VendaItem(_p4, 10); _vi5 = new VendaItem(_p5, 10); }
public void DadoUmaVendaSemPagamentoRetornaFalse() { var command = new GeraVendaCommand(new Usuario("Daniel", "123456")); command.Itens.Add(new VendaItem(new Produto("martelo", "7898124565", "desc...", 10.0m, 15.0m), 2)); var handler = new GeraVendaHandler(new FakeRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Sucesso, false); }
public void DadoUmaVendaComPagamentoRetornaTrue() { var command = new GeraVendaCommand(new Usuario("Daniel", "123456")); command.Itens.Add(new VendaItem(new Produto("martelo", "7898124565", "desc...", 10.0m, 15.0m), 2)); command.Pagamentos.Add(new VendaPagamento(30.0m, Domain.Enums.EPagamentoTipo.Dinheiro)); var handler = new GeraVendaHandler(new FakeRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Sucesso, true); }
public GenericCommandResult GeraVenda([FromBody] GeraVendaCommand command) { return((GenericCommandResult)_handler.Handle(command)); }