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 BankAccountCannotSetTransientCustomer()
        {
            //Arrange
            var customer = CustomerFactory.CreateCustomer("Unai", "Zorrilla Castro", IdentityGenerator.NewSequentialGuid(),new Address("city","zipcode","AddressLine1","AddressLine2"));

            var bankAccount = new BankAccount();

            //Act
            bankAccount.SetCustomer(customer);
        }
        /// <summary>
        /// Create a new instance of bankaccount
        /// </summary>
        /// <param name="customer">The customer associated with this bank account</param>
        /// <param name="bankAccountNumber">The bank account number</param>
        /// <returns>A valid bank account</returns>
        public static BankAccount CreateBankAccount(Customer customer, BankAccountNumber bankAccountNumber)
        {
            var bankAccount = new BankAccount();

            //set the bank account number
            bankAccount.BankAccountNumber = bankAccountNumber;

            //set default bank account as unlocked
            bankAccount.UnLock();

            //set the customer for this bank account
            bankAccount.SetCustomer(customer);

            return bankAccount;
        }
        public void AdaptEnumerableBankAccountToListBankAccountListDTO()
        {
            //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");
            var accounts = new List<BankAccount>() { account };

            //Act
            ITypeAdapter adapter = PrepareTypeAdapter();
            var bankAccountsDTO = adapter.Adapt<IEnumerable<BankAccount>, List<BankAccountDTO>>(accounts);

            //Assert
            Assert.IsNotNull(bankAccountsDTO);
            Assert.IsTrue(bankAccountsDTO.Count == 1);

            Assert.AreEqual(account.Id, bankAccountsDTO[0].Id);
            Assert.AreEqual(account.Iban, bankAccountsDTO[0].BankAccountNumber);
            Assert.AreEqual(account.Balance, bankAccountsDTO[0].Balance);
            Assert.AreEqual(account.Customer.FirstName, bankAccountsDTO[0].CustomerFirstName);
            Assert.AreEqual(account.Customer.LastName, bankAccountsDTO[0].CustomerLastName);
        }
        public void BankAccountSetCustomerFixCustomerId()
        {
            //Arrange
            Guid countryId = IdentityGenerator.NewSequentialGuid();
            Customer customer = CustomerFactory.CreateCustomer("Unai", "Zorrilla Castro", countryId, new Address("city", "zipcode", "AddressLine1", "AddressLine2"));
            customer.Id = IdentityGenerator.NewSequentialGuid();
            //Act
            BankAccount bankAccount = new BankAccount();
            bankAccount.SetCustomer(customer);

            //Assert
            Assert.AreEqual(customer.Id, bankAccount.CustomerId);
        }