public void TestaRegraPromocaoCarne() { //Arrange PedidoRepository pedidoRepo = new PedidoRepository(); ItemPedidoRepository itemRepo = new ItemPedidoRepository(); FecharPedidoModel hamburger = new FecharPedidoModel() { idItemPedido = 10, idPedido = 4, idLanche = 2, idIngrediente = 4, idItemPedidoIngrediente = 1, valor = 3, quantidade = 10, nomeLanche = "X-Bacon" }; PromocaoBusiness promocaoBussiness = new PromocaoBusiness(itemRepo, pedidoRepo); //Act promocaoBussiness.promocaoCarne(new List <FecharPedidoModel>() { hamburger }); //Assert Assert.Equal(hamburger.valorDesconto, 9); }
public void TestaRegraPromocaoQueijo() { //Arrange PedidoRepository pedidoRepo = new PedidoRepository(); ItemPedidoRepository itemRepo = new ItemPedidoRepository(); FecharPedidoModel queijo = new FecharPedidoModel() { idItemPedido = 10, idPedido = 4, idLanche = 2, idIngrediente = 6, idItemPedidoIngrediente = 1, valor = 1.50, quantidade = 10, nomeLanche = "X-Bacon" }; PromocaoBusiness promocaoBussiness = new PromocaoBusiness(itemRepo, pedidoRepo); //Act promocaoBussiness.promocaoQueijo(new List <FecharPedidoModel>() { queijo }); //Assert Assert.Equal(queijo.valorDesconto, 4.50); }
public void TestaRegraPromocoesLight() { //Arrange PedidoRepository pedidoRepo = new PedidoRepository(); ItemPedidoRepository itemRepo = new ItemPedidoRepository(); FecharPedidoModel alface = new FecharPedidoModel() { idItemPedido = 10, idPedido = 4, idLanche = 2, idIngrediente = 2, idItemPedidoIngrediente = 1, valor = 0.40, quantidade = 1, nomeLanche = "X-Bacon" }; PromocaoBusiness promocaoBussiness = new PromocaoBusiness(itemRepo, pedidoRepo); //Act promocaoBussiness.promocaoLight(new List <FecharPedidoModel>() { alface }); //Assert Assert.Equal(alface.valorDesconto, 0.04); }
public string AtualizarIngrediente(FecharPedidoModel itemPedidoIngrediente) { try { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@ID", itemPedidoIngrediente.idItemPedidoIngrediente, DbType.Int32, ParameterDirection.Input); parameters.Add("@IDITEMPEDIDO", itemPedidoIngrediente.idItemPedido, DbType.Int32, ParameterDirection.Input); parameters.Add("@IDINGREDIENTE", itemPedidoIngrediente.idIngrediente, DbType.Int32, ParameterDirection.Input); parameters.Add("@VALOR", itemPedidoIngrediente.valor, DbType.Double, ParameterDirection.Input); parameters.Add("@QUANTIDADE", itemPedidoIngrediente.quantidade, DbType.Int32, ParameterDirection.Input); parameters.Add("@VALORDESCONTO", itemPedidoIngrediente.valorDesconto, DbType.Double, ParameterDirection.Input); return(Executar("SP_ITEMPEDIDO_ATUALIZAR_INGREDIENTE", parameters, CommandType.StoredProcedure)); } catch (Exception ex) { throw new Exception(ex.Message); } finally { Dispose(); } }