コード例 #1
0
        public void Processa(List <Boleto> boletos, Fatura fatura)
        {
            foreach (Boleto boleto in boletos)
            {
                Pagamento pagamento = new Pagamento(boleto.Valor, MeioDePagamento.BOLETO);
                fatura.AdicionaPagamento(pagamento);

                total += boleto.Valor;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            List <Boleto> boletos = new List <Boleto>();

            boletos.Add(new Boleto(200));
            boletos.Add(new Boleto(300));
            boletos.Add(new Boleto(400));

            Fatura fatura = new Fatura("Caelum", 900);

            ProcessadorDeBoletos pdb = new ProcessadorDeBoletos();

            pdb.Processa(boletos, fatura);

            Console.WriteLine(fatura.Pago);
            Console.ReadKey();
        }