Esempio n. 1
0
        public void Processa(IList <Boleto> boletos, Fatura fatura)
        {
            Boleto boleto = boletos[0];

            Pagamento pagamento = new Pagamento(boleto.Valor, MeioDePagamento.BOLETO);

            fatura.Pagamentos.Add(pagamento);
        }
Esempio n. 2
0
        public void Processa(IList <Boleto> boletos, Fatura fatura)
        {
            foreach (var boleto in boletos)
            {
                Pagamento pagamento = new Pagamento(boleto.Valor, MeioDePagamento.BOLETO);

                fatura.Pagamentos.Add(pagamento);
            }
        }
Esempio n. 3
0
        public void DeveMarcarFaturaComoPagaCasoBoletoUnicoPagueTudo()
        {
            ProcessadorDeBoletos processador = new ProcessadorDeBoletos();

            Fatura         fatura  = new Fatura("Cliente", 150.0);
            Boleto         b1      = new Boleto(150.0);
            IList <Boleto> boletos = new List <Boleto>()
            {
                b1
            };

            processador.Processa(boletos, fatura);

            Assert.IsTrue(fatura.Pago);
        }
Esempio n. 4
0
        public void DeveProcessarPagamentoViaBoletoUnico()
        {
            ProcessadorDeBoletos processador = new ProcessadorDeBoletos();

            Fatura         fatura  = new Fatura("Cliente", 150.0);
            Boleto         b1      = new Boleto(150.0);
            IList <Boleto> boletos = new List <Boleto>()
            {
                b1
            };

            processador.Processa(boletos, fatura);

            Assert.AreEqual(1, fatura.Pagamentos.Count);
            Assert.AreEqual(150.0, fatura.Pagamentos[0].Valor, 0.00001);
        }
        public void DeveProcessarPagamentoViaMuitosBoletos()
        {
            ProcessadorDeBoletos processador = new ProcessadorDeBoletos();

            Fatura        fatura  = new Fatura("Cliente", 300.0);
            Boleto        b1      = new Boleto(100.0);
            Boleto        b2      = new Boleto(200.0);
            List <Boleto> boletos = new List <Boleto>()
            {
                b1, b2
            };

            processador.Processa(boletos, fatura);

            Assert.AreEqual(2, fatura.Pagamentos.Count);
            Assert.AreEqual(100.0, fatura.Pagamentos[0].Valor, 0.00001);
            Assert.AreEqual(200.0, fatura.Pagamentos[1].Valor, 0.00001);
        }
Esempio n. 6
0
        public void Processa(IList <Boleto> boletos, Fatura fatura)
        {
            double valorTotal = 0;

            foreach (var boleto in boletos)
            {
                Pagamento pagamento = new Pagamento(boleto.Valor, MeioDePagamento.BOLETO);

                fatura.Pagamentos.Add(pagamento);

                valorTotal += boleto.Valor;
            }

            if (valorTotal >= fatura.Valor)
            {
                fatura.Pago = true;
            }
        }