public static String Proceseaza(double sum, ContDTO source) { AG_ROOT_Cont sursa = new AG_ROOT_Cont(new Modele.Generic.IBAN(source.iban), new Client(new PlainText(source.client), new PlainText("nu conteaza")), new Suma(source.Sold)); AG_ROOT_Cont result = sursa.DepuneBani(new Suma(sum)); //Pregateste rezultatul tranzactiei ca raspuns inapoi catre MVC //obtine tranzactia sursei TranzactieDTO tranzDTO = new TranzactieDTO(); tranzDTO.partenerTranzactie = result.IstoricTranzactii.getTranzactii.First().PartenerTranzactie.getIBAN; tranzDTO.suma = result.IstoricTranzactii.getTranzactii.First().Suma.getSuma; tranzDTO.data = DateTime.Today.ToString(); if (result.IstoricTranzactii.getTranzactii.First().Tip.Equals(TipTranzactie.Depunere)) { tranzDTO.tipTranz = "depunere"; } //obtine datele contului modificat ContDTO updatedAccount = new ContDTO(); updatedAccount.client = result.DateClient.Nume.Text; updatedAccount.iban = result.IBAN.getIBAN; updatedAccount.Sold = result.Sold.getSuma; return(new SerializedResultDTO(updatedAccount, tranzDTO).Serialize()); }
public void DepuneBani() { //clientul are 100 de lei in cont var cont = new AG_ROOT_Cont(new IBAN("RO22BACX6548206443372891"), new Client(new PlainText("Ion"), new PlainText("timisoara")), new Suma(100)); cont.DepuneBani(new Suma(50)); //depune 50 Assert.Equal(150.0, cont.Sold.getSuma); //verifica ca s-au depus }