public void AdaptBankAccountToBankAccountDTO() { //Arrange var customer = CustomerFactory.CreateCustomer("jhon", "el rojo", Guid.NewGuid(), new Address("", "", "", "")); customer.Id = IdentityGenerator.NewSequentialGuid(); BankAccount account = new BankAccount(); account.Id = IdentityGenerator.NewSequentialGuid(); account.BankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"); account.SetCustomer(customer); account.DepositMoney(1000, "reason"); account.Lock(); //Act ITypeAdapter adapter = PrepareTypeAdapter(); var bankAccountDTO = adapter.Adapt<BankAccount, BankAccountDTO>(account); //Assert Assert.AreEqual(account.Id, bankAccountDTO.Id); Assert.AreEqual(account.Iban, bankAccountDTO.BankAccountNumber); Assert.AreEqual(account.Balance, bankAccountDTO.Balance); Assert.AreEqual(account.Customer.FirstName, bankAccountDTO.CustomerFirstName); Assert.AreEqual(account.Customer.LastName, bankAccountDTO.CustomerLastName); Assert.AreEqual(account.Locked, bankAccountDTO.Locked); }
public void AdaptBankAccountToBankAccountDto() { //Arrange var country = new Country("Spain", "es-ES"); country.GenerateNewIdentity(); var customer = CustomerFactory.CreateCustomer( "jhon", "el rojo", "+3441", "company", country, new Address("", "", "", "")); customer.GenerateNewIdentity(); var account = new BankAccount(); account.GenerateNewIdentity(); account.BankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02"); account.SetCustomerOwnerOfThisBankAccount(customer); account.DepositMoney(1000, "reason"); account.Lock(); //Act var adapter = TypeAdapterFactory.CreateAdapter(); var bankAccountDto = adapter.Adapt<BankAccount, BankAccountDto>(account); //Assert Assert.AreEqual(account.Id, bankAccountDto.Id); Assert.AreEqual(account.Iban, bankAccountDto.BankAccountNumber); Assert.AreEqual(account.Balance, bankAccountDto.Balance); Assert.AreEqual(account.Customer.FirstName, bankAccountDto.CustomerFirstName); Assert.AreEqual(account.Customer.LastName, bankAccountDto.CustomerLastName); Assert.AreEqual(account.Locked, bankAccountDto.Locked); }