Пример #1
0
        private static void SendResponse(BankCustomer customer, string correlationId)
        {
            var bankResponse = new BankResponse()
            {
                FullName     = customer.FullName,
                EmailAddress = customer.EmailAddress,
                Response     = true
            };

            var queue      = EndPoints.FromBankQueueName;
            var routingKey = EndPoints.FromBankRoutingKey;

            var connection = GetConnection.ConnectionGetter();

            using var channel = connection.CreateModel();
            channel.ExchangeDeclare(exchange: exchangeName,
                                    durable: true,
                                    type: ExchangeType.Direct);

            channel.QueueDeclare(queue: queue,
                                 durable: true,
                                 exclusive: false,
                                 autoDelete: false,
                                 arguments: null);

            channel.QueueBind(queue, exchangeName, routingKey);

            Console.WriteLine("Besked sendt:");
            Console.WriteLine("- - - - - - - - - - - - - - -");
            Console.WriteLine($"Navn: {bankResponse.FullName}");
            Console.WriteLine($"Email: {bankResponse.EmailAddress}");
            Console.WriteLine($"CorrelationId: {correlationId}");
            Console.WriteLine($"Svar fra banken: {(bankResponse.Response ? "Positivt" : "Negativt")}");
            Console.WriteLine("------------------------------");

            var message = JsonSerializer.Serialize(bankResponse);

            var body = Encoding.UTF8.GetBytes(message);

            var props = channel.CreateBasicProperties();

            props.CorrelationId = correlationId;
            props.Persistent    = true;

            channel.BasicPublish(exchange: exchangeName,
                                 routingKey: routingKey,
                                 basicProperties: props,
                                 body: body);

            CloseConnection.CloseAll(channel, connection);
        }
Пример #2
0
        public void BankCustomer_AddAccountTests()
        {
            BankCustomer TestedInstanceBankCustomer = new BankCustomer();
            BankAccount  First  = new BankAccount();
            BankAccount  Second = new BankAccount();

            TestedInstanceBankCustomer.Accounts = new BankAccount[] { First, Second };

            BankCustomer Tested = new BankCustomer();

            Tested.AddAccount(First);
            Tested.AddAccount(Second);
            Assert.AreEqual(TestedInstanceBankCustomer.Accounts.Length, Tested.Accounts.Length);
        }
Пример #3
0
        public void QueueContentsEnum(DefinedQueue localQueue)
        {
            BankCustomer tempCustomer = new BankCustomer();

            // get the built in enumerator
            System.Collections.IEnumerator en = localQueue.GetEnumerator();
            Console.WriteLine(" ");
            Console.WriteLine("View the queue using an enumerator");
            while (en.MoveNext())
            {
                tempCustomer = (BankCustomer)en.Current;
                Console.WriteLine("Name: " + tempCustomer.name + ",  Activity: " + tempCustomer.bankingActivity + ",  Account no: " + tempCustomer.accountNumber.ToString() + ", Amount $" + tempCustomer.amount.ToString());
            }
        }
Пример #4
0
        public IActionResult OnGet()
        {
            string val = HttpContext.Session.GetString("sessionID");

            if (HttpContext.Session.GetString("sessionID") == null || HttpContext.Session.GetString("sessionID") == "")
            {
                return(Redirect("Index"));
            }
            else
            {
                user = SessionManager.GetSession(HttpContext.Session.GetString("sessionID"));
                return(Page());
            }
        }
    private void Save(BankCustomer newUser)
    {
        MultiView1.ActiveViewIndex = 0;
        Result result = client.SaveBankCustomerDetails(newUser, user.BankCode, bll.BankPassword);

        if (result.StatusCode == "0")
        {
            Response.Redirect("~/AddOrEditBankAccount.aspx?UserId=" + newUser.Id + "&BankCode=" + newUser.BankCode + "&BranchCode=" + newUser.BranchCode + "&Msg=CREATE A CUSTOMER ACCOUNT FOR THIS CUSTOMER");
        }
        else
        {
            string msg = result.StatusDesc;
            bll.ShowMessage(lblmsg, msg, true, Session);
        }
    }
Пример #6
0
        public void TestToSeeIfCustomerDoesntMakeVIPStatus()
        {
            BankCustomer    newCustomer = new BankCustomer();
            CheckingAccount a1          = new CheckingAccount();
            DollarAmount    d1          = new DollarAmount(1000000);
            SavingsAccount  a2          = new SavingsAccount();

            newCustomer.AddAccount(a1);
            newCustomer.AddAccount(a2);
            a1.Deposit(d1);
            DollarAmount d2 = new DollarAmount(1000000);

            a2.Deposit(d2);
            Assert.IsFalse(newCustomer.IsVip);
        }
Пример #7
0
        public void CheckToSeeIfWeCanCreateOneProfileWithMultipleAccounts()
        {
            BankCustomer    newCustomer  = new BankCustomer(); //I wanted to be dilegent about the amount of accounts the customer had
            CheckingAccount accountOne   = new CheckingAccount();
            SavingsAccount  accountTwo   = new SavingsAccount();
            SavingsAccount  accountThree = new SavingsAccount();

            newCustomer.AddAccount(accountTwo);
            newCustomer.AddAccount(accountOne);
            newCustomer.AddAccount(accountThree);
            Assert.AreEqual(3, newCustomer.Accounts.Length);
            Assert.AreEqual(newCustomer.Accounts[0], accountTwo);
            Assert.AreEqual(newCustomer.Accounts[1], accountOne);
            Assert.AreEqual(newCustomer.Accounts[2], accountThree);
        }
Пример #8
0
        public void QueueContentsCopy(DefinedQueue localQueue)
        {
            BankCustomer tempCustomer     = new BankCustomer();
            DefinedQueue copyoflocalQueue = new DefinedQueue();

            // make the copy
            copyoflocalQueue = (DefinedQueue)localQueue.Clone();
            Console.WriteLine(" ");
            Console.WriteLine("View the queue using a copy");
            do
            {
                tempCustomer = (BankCustomer)copyoflocalQueue.Dequeue();
                Console.WriteLine("Name: " + tempCustomer.name + ",  Activity: " + tempCustomer.bankingActivity + ",  Account no: " + tempCustomer.accountNumber.ToString() + ", Amount $" + tempCustomer.amount.ToString());
            } while (copyoflocalQueue.Count != 0);
        }
        public async Task <BankCustomer> RegisterNewUser(string firstName, string lastName, string username, string password)
        {
            BankCustomer customer = new BankCustomer
            {
                FirstName    = firstName,
                LastName     = lastName,
                Usernname    = username,
                passwordHash = CryptoService.ComputeHash(password)
            };

            // the server replies with added fields
            LoggedInCustomer = await HttpMgr.Instance.PostCustomerAsync(customer);

            return(LoggedInCustomer);
        }
Пример #10
0
        public void Verify_VIP_Status_Works_WithMultiplAccounts()
        {
            BankCustomer customer = new BankCustomer();
            BankAccount  bank     = new BankAccount();
            BankAccount  bank2    = new BankAccount();

            customer.AddAccount(bank, "TEST1");
            customer.AddAccount(bank2, "TEST2");

            bank.Deposit(12500);
            bank2.Deposit(12500);


            Assert.IsTrue(customer.IsVIP);
        }
Пример #11
0
        public void BankCustomer_isVIPTests()
        {
            BankCustomer TestedVip = new BankCustomer();
            BankAccount  First     = new BankAccount();
            BankAccount  Second    = new BankAccount();

            TestedVip.Accounts = new BankAccount[] { First, Second, new BankAccount() };
            TestedVip.Accounts[0].Deposit(new DollarAmount(100));
            TestedVip.Accounts[1].Deposit(new DollarAmount(500));
            TestedVip.Accounts[2].Deposit(new DollarAmount(1000));
            Assert.IsFalse(TestedVip.isVipCustomer());
            TestedVip.Accounts[0].Deposit(new DollarAmount(250000));
            TestedVip.Accounts[1].Deposit(new DollarAmount(500000000));
            TestedVip.Accounts[2].Deposit(new DollarAmount(1000000));
            Assert.IsTrue(TestedVip.isVipCustomer());
        }
Пример #12
0
        private async void RegisterButtonClick(object sender, RoutedEventArgs e)
        {
            string firstName = registerFirstNameTextBox.Text;
            string lastName  = registerLastNameTextBox.Text;
            string username  = registerUserNameTextBox.Text;
            string password  = registerPasswordBox.Password;

            if (Utils.IsAnyEmptyOrNull(firstName, lastName, username, password))
            {
                Common.DisplayErrorBox("One or more fields is empty");
            }

            BankCustomer createdCustomer = await CustomerManager.Instance.RegisterNewUser(firstName, lastName, username, password);

            Common.DisplaySuccessBox("Account created succesfully");
            Login(CustomerManager.Instance.LoggedInCustomer);
        }
        private async Task ReloadUserAccounts()
        {
            BankCustomer customer = CustomerManager.Instance.LoggedInCustomer;

            List <BankAccount> accounts = await AccountManager.Instance.LoadAccountsForUserAsync(customer);

            if (accounts is null || accounts.Count == 0)
            {
                return;
            }

            userAccountsComboBox.ItemsSource = from account in accounts
                                               select $"{account.IBAN}\t{account.BalanceEur}";

            // Keep the same selection, otherwise set to 0
            userAccountsComboBox.SelectedIndex = (userAccountsComboBox.SelectedIndex == -1) ? 0 : userAccountsComboBox.SelectedIndex;
        }
Пример #14
0
        // [STAThread]
        static void Main(string[] args)
        {
            BankCustomer bc = new BankCustomer("John", "Doe");
            int          a = 60; int b = 40;

            Console.WriteLine($"Before Call : a ={a}, b ={b}");
            int c = BankCustomer.Add(ref a, ref b);

            Console.WriteLine($"After Call: a ={a}, b ={b}, c ={c}");

            BankCustomer.Add(a, b, out int d);

            Console.WriteLine(d);
            Console.ReadLine();

            bc.DoSomething();
            Console.ReadLine();
            Console.WriteLine(bc.FullName);
            Console.WriteLine(new BankCustomer().PurchaseMsg);
            Customer a1 = new Customer {
                FirstName = "Segun",
                LastName  = "Arinze",
                Age       = 50,
            };
            SalesTransaction st  = new SalesTransaction(a1);
            SalesTransaction st2 = new SalesTransaction(new Customer {
                FirstName = "Alfred",
                LastName  = "Obialo",
            });


            new SalesTransaction(new Customer {
                FirstName = "Alfred",
                LastName  = "Obialo",
            }).PostInvoice("INV-0001", DateTime.Today.AddHours(-3));

            // CreateFile($"{a.FirstName} {a.LastName}");

            UserIdentity user1 = new UserIdentity();

            user1.CompanyInfo.Name = "New Company";
            Console.WriteLine(user1.CompanyInfo.Name);
            Console.WriteLine("Hello Dll");
            ReadLine();
        }
Пример #15
0
    private void SaveVariablesInViewState(BankCustomer cust)
    {
        List <string> AccountSignatories = ViewState["AccountSignatories"] as List <string>;

        if (AccountSignatories == null)
        {
            AccountSignatories = new List <string>();
            AccountSignatories.Add(cust.Id);
        }
        else
        {
            AccountSignatories.Add(cust.Id);
        }
        ViewState["AccountSignatories"] = AccountSignatories;
        string msg = "CUSTOMER ADDED AS SIGNATORY. NUMBER OF SIGNATORIES ADDED: " + AccountSignatories.Count;

        bll.ShowMessage(lblmsg, msg, false, Session);
    }
Пример #16
0
        public async Task <BankCustomer> PostCustomerAsync(BankCustomer customer)
        {
            BankCustomer bankCustomer;

            using (HttpClient httpClient = new HttpClient(GetNewHandler()))
            {
                string data    = JsonSerializer.Serialize <BankCustomer>(customer);
                var    content = new StringContent(data, Encoding.UTF8, "application/json");
                using (var response = await httpClient.PostAsync($"{SERVER}:{PORT}/api/BankCustomers", content))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    bankCustomer = JsonSerializer.Deserialize <BankCustomer>(apiResponse);
                }
            }

            return(bankCustomer);
        }
Пример #17
0
        public void US_3_in_order_to_check_his_operation_a_customer_can_see_them_with_operation_date_amount_balance()
        {
            BankCustomer bankCustomer = new BankCustomer();
            Amount       moneyToSave  = Amount.Of(20);
            DateTime     actualDate   = DateTime.Now;

            bankCustomer.MakeADeposit(moneyToSave, actualDate);

            Amount moneyRetrieved = bankCustomer.WithdrawAllSaves(actualDate);

            bankCustomer.MakeADeposit(moneyToSave, actualDate);

            StringBuilder stringBuilder = new StringBuilder("List of operations :");

            stringBuilder.AppendLine();
            stringBuilder.Append("Operation : " + OperationName.Deposit);
            stringBuilder.Append(", ");
            stringBuilder.Append("date : " + actualDate);
            stringBuilder.Append(", ");
            stringBuilder.Append("amount after operation : " + moneyToSave);
            stringBuilder.Append(", ");
            stringBuilder.Append("balance : " + moneyToSave);

            stringBuilder.AppendLine();

            stringBuilder.Append("Operation : " + OperationName.WithdrawAll);
            stringBuilder.Append(", ");
            stringBuilder.Append("date : " + actualDate);
            stringBuilder.Append(", ");
            stringBuilder.Append("amount after operation : 0");
            stringBuilder.Append(", ");
            stringBuilder.Append("balance : " + moneyToSave.GetOppositeAmount());

            stringBuilder.AppendLine();

            stringBuilder.Append("Operation : " + OperationName.Deposit);
            stringBuilder.Append(", ");
            stringBuilder.Append("date : " + actualDate);
            stringBuilder.Append(", ");
            stringBuilder.Append("amount after operation : " + moneyToSave);
            stringBuilder.Append(", ");
            stringBuilder.AppendLine("balance : " + moneyToSave);
            bankCustomer.SeeOperationsOfAccount().ToString().Should().Be(stringBuilder.ToString());
        }
        public void GetCustomerAccounts()
        {  //Arrange - Create a customer plus some accounts for that customer
            BankCustomer    cust      = new BankCustomer();
            SavingsAccount  savings   = new SavingsAccount("asdf", "123");
            CheckingAccount checking1 = new CheckingAccount("asdfj", "123");
            CheckingAccount checking2 = new CheckingAccount("asdfj", "123");

            cust.AddAccount(checking1);
            cust.AddAccount(checking2);
            cust.AddAccount(savings);


            //Act - call getaccounts
            IAccountable[] actualAccounts = cust.GetAccounts();
            //assert - verify all accounts are returned
            IAccountable[] expectedAccounts = new IAccountable[] { savings, checking1, checking2 };
            //CollectionAssert.AreEqual(expectedAccounts, actualAccounts); // has to have the same lineup in the collection that you are checking into
            CollectionAssert.AreEquivalent(expectedAccounts, actualAccounts); // checks to make sure the name is in the collection, order doesn't matter.
        }
Пример #19
0
        public void getCustomerAccounts(string accountHolderName, string accountNumber)
        {
            BankCustomer    cust      = new BankCustomer();
            SavingsAccount  savings   = new SavingsAccount(accountHolderName, accountNumber);
            CheckingAccount checking1 = new CheckingAccount(accountHolderName, accountNumber);
            CheckingAccount checking2 = new CheckingAccount(accountHolderName, accountNumber);

            IAccountable[] expectedAccounts = new IAccountable[] { savings, checking1, checking2 };
            cust.AddAccount(savings);
            cust.AddAccount(checking2);
            cust.AddAccount(checking1);


            IAccountable[] actualAccounts = cust.GetAccounts();


            //CollectionAssert.AreEqual(expectedAccounts, actualAccounts);
            CollectionAssert.AreEquivalent(expectedAccounts, actualAccounts);
        }
Пример #20
0
        public void IsVIPTest()
        {
            BankAccount  newAccount   = new BankAccount();
            BankCustomer thisCustomer = new BankCustomer("Steve", "100 Steeve Lane", "123456789");
            DollarAmount thisDeposit  = new DollarAmount(300000);

            thisCustomer.AddAccount(newAccount);
            newAccount.Deposit(thisDeposit);
            bool result = thisCustomer.IsVip();

            Assert.AreEqual(false, result);

            DollarAmount newDeposit = new DollarAmount(2200000);

            newAccount.Deposit(newDeposit);
            bool newtest = thisCustomer.IsVip();

            Assert.AreEqual(true, newtest);
        }
        public void BankCustomerTest()
        {
            BankCustomer newCustomer = new BankCustomer();

            newCustomer.Name        = "Lucy";
            newCustomer.PhoneNumber = "(555)333-2018";
            newCustomer.Address     = "McDonalds Dumpster";

            // test properties of BankCustomer
            Assert.AreEqual("Lucy", newCustomer.Name, "Name is messed up.");
            Assert.AreEqual("(555)333-2018", newCustomer.PhoneNumber, "PhoneNumber is messed up.");
            Assert.AreEqual("McDonalds Dumpster", newCustomer.Address, "Address is messed up.");


            CheckingAccount newChecking = new CheckingAccount();

            Assert.AreEqual(300, newChecking.Deposit(300), "Issue w/ checking deposit");
            newChecking.AccountNumber = "1";

            newCustomer.AddAccount(newChecking);

            Assert.AreEqual(300, newCustomer.Accounts[0].Balance, "Customer account balance issue");

            // test added accounts!!! WOOOOO!!!

            SavingsAccount newSavings = new SavingsAccount();

            newCustomer.AddAccount(newSavings);

            newCustomer.Accounts[1].Deposit(50);
            newCustomer.Accounts[1].Withdraw(10);

            Assert.AreEqual(38, newCustomer.Accounts[1].Balance, "Issue with BankCustomer's savings account");

            // VIP tests
            newCustomer.Accounts[0].Deposit(20000);
            newCustomer.Accounts[1].Deposit(5000);

            Assert.AreEqual(true, newCustomer.IsVIP, "IsVIP is being applied to a customer whom is not a VIP");

            newCustomer.Accounts[0].Withdraw(20000);
            Assert.AreEqual(false, newCustomer.IsVIP, "IsVIP is counting something as VIP that shouldn't be");
        }
Пример #22
0
        static void Main(string[] args)
        {
            // create a Bank
            Bank ThomastonBankandTrust = new Bank();
            // create a customer
            BankCustomer JP = new BankCustomer("J P Morgan", Bank.BankingActivity.deposit.ToString(), 335445, 30000);

            // add the customer to the TellerLine
            ThomastonBankandTrust.localBankQueue.Enqueue(JP);
            BankCustomer Butch    = new BankCustomer("Butch Cassidy", Bank.BankingActivity.transferFunds.ToString(), 555445, 3500);
            BankCustomer Sundance = new BankCustomer("Sundance Kid", Bank.BankingActivity.withdrawl.ToString(), 555444, 3500);
            BankCustomer John     = new BankCustomer("John Dillinger", Bank.BankingActivity.withdrawl.ToString(), 12345, 2000);

            ThomastonBankandTrust.localBankQueue.Enqueue(Sundance);
            ThomastonBankandTrust.localBankQueue.Enqueue(Butch);
            ThomastonBankandTrust.localBankQueue.Enqueue(John);

            Console.WriteLine("Peek: " + ThomastonBankandTrust.localBankQueue.Peek());

            // Pause
            Console.ReadLine();
            ThomastonBankandTrust.QueuePeek(ThomastonBankandTrust.localBankQueue);
            // View the queue using a copy
            ThomastonBankandTrust.QueueContentsCopy(ThomastonBankandTrust.localBankQueue);
            // view the queue through enumeration
            ThomastonBankandTrust.QueueContentsEnum(ThomastonBankandTrust.localBankQueue);

            // Pause
            Console.ReadLine();
            // verify that the origional queue is not modified.
            Console.WriteLine("Count of items in queue after copy & enum :" + ThomastonBankandTrust.localBankQueue.Count.ToString());
            do
            {
                BankCustomer nextInLine = new BankCustomer();
                nextInLine = (BankCustomer)ThomastonBankandTrust.localBankQueue.Dequeue();
                ThomastonBankandTrust.ProcessCustomerRequest(nextInLine);
                // Pause
                Console.ReadLine();
            } while (ThomastonBankandTrust.localBankQueue.Count != 0);

            // Pause
            Console.ReadLine();
        }
Пример #23
0
        public async Task <IActionResult> OnPostAsync()
        {
            var filter = Builders <BankCustomer> .Filter.Eq("email", cust.Email);

            var projection = Builders <BankCustomer> .Projection.Include("email").Include("passwordHash");

            var doc = await DBInterface.cust.Find(filter).Project(projection).FirstOrDefaultAsync();

            var user = BankCustomer.ToBankCustomer(doc);

            if (cust.Password.Equals(user.Password))
            {
                var sess = await SessionManager.InsertSession(user);

                HttpContext.Session.SetString("sessionID", (sess.SessionID));
                return(RedirectToPage("/Dashboard"));
            }
            return(Page());
        }
Пример #24
0
        public async Task <BankCustomerDto> NewCustomer(NewCustomerRequest request)
        {
            if (string.IsNullOrWhiteSpace(request.Document))
            {
                throw new InvalidOperationException("Document is Empty!");
            }

            var customer = await bankCustomerRepository.FindCustomerByDocumentAsync(request.Document);

            if (customer != null)
            {
                throw new InvalidOperationException("Customer is already registered!");
            }

            customer = new BankCustomer(request.Document, request.Name, $"{request.Name} {request.LastName}".Trim(), request.Address);

            await bankCustomerRepository.InsertAsync(customer);

            return(mapper.Map <BankCustomerDto>(customer));
        }
    private BankCustomer GetBankCustomer()
    {
        BankCustomer aUser = new BankCustomer();

        aUser.BankCode         = ddBank.SelectedValue;
        aUser.BranchCode       = ddBankBranch.SelectedValue;
        aUser.DateOfBirth      = txtDateOfBirth.Text;
        aUser.Email            = txtEmail.Text;
        aUser.FullName         = txtBankUsersName.Text;
        aUser.Gender           = ddGender.Text;
        aUser.Id               = txtUserId.Text;
        aUser.IsActive         = ddIsActive.Text;
        aUser.ModifiedBy       = user.Id;
        aUser.Password         = bll.GeneratePassword();
        aUser.PhoneNumber      = txtPhoneNumber.Text;
        aUser.PathToProfilePic = GetPathToProfilePicImage(ddBank.SelectedValue);
        aUser.PathToSignature  = GetPathToImageOfSignature(ddBank.SelectedValue);
        aUser.ApprovedBy       = user.Id;
        return(aUser);
    }
Пример #26
0
        public void BankCustomer()
        {
            BankCustomer nickC = new BankCustomer();

            nickC.Name        = "Nick Collins";
            nickC.Address     = "1275 Kinnear Rd";
            nickC.PhoneNumber = "614-888-8888";

            CheckingAccount nicksCheckingAcct = new CheckingAccount();

            nicksCheckingAcct.Deposit(new DollarAmount(30000, 00));

            nickC.AddAccount(nicksCheckingAcct);
            //Make sure Nick's Checking Account is in his Account list.
            Assert.AreEqual(nicksCheckingAcct, nickC.Accounts[0]);
            //Nicks Checking account has 30 grand in it (per usual)
            Assert.AreEqual("$30000.00", nickC.Accounts[0].Balance.ToString());
            //Making sure Nick is a VIP
            Assert.AreEqual(true, nickC.IsVIP);
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         BankCustomer newUser = GetBankCustomer();
         if (bll.Exists(newUser))
         {
             MultiView1.ActiveViewIndex = 1;
         }
         else
         {
             Save(newUser);
         }
     }
     catch (Exception ex)
     {
         string msg = "FAILED: " + ex.Message;
         bll.ShowMessage(lblmsg, msg, true, Session);
     }
 }
Пример #28
0
        public void Customer_AddNewAccountTest()
        {
            //Arrange
            CheckingAccount c1 = new CheckingAccount();
            SavingsAccount  s1 = new SavingsAccount();
            BankAccount     bankaccountNewA = new BankAccount();
            BankAccount     bankaccountNewB = new BankAccount();
            BankAccount     bankaccountNewC = new BankAccount();
            BankAccount     bankaccountNewD = new BankAccount();

            List <BankAccount> expectedListOfAccounts = new List <BankAccount>();

            expectedListOfAccounts.Add(c1);
            expectedListOfAccounts.Add(s1);
            expectedListOfAccounts.Add(bankaccountNewA);
            expectedListOfAccounts.Add(bankaccountNewC);

            List <BankAccount> listCustomerAccounts = new List <BankAccount>();

            expectedListOfAccounts.Add(c1);
            expectedListOfAccounts.Add(s1);
            expectedListOfAccounts.Add(bankaccountNewA);

            BankAccount newAccount = bankaccountNewC;

            testBankCustomer.AddAccount(bankaccountNewC);

            string       expectedName                = "First.Last Name";
            string       expectedAddress             = "1234 MadeUp Street Cbus, OH 43231";
            string       expectedPhoneNumber         = "614-FOR-HELP";
            BankCustomer isVipBankCustomer           = new BankCustomer(expectedName, expectedAddress, expectedPhoneNumber, true);
            BankCustomer hasFourAccountsBankCustomer = new BankCustomer("Name", "Address", "PhoneNumber", false);

            //Act
            isVipBankCustomer.AddAccount(bankaccountNewC);
            hasFourAccountsBankCustomer.AddAccount(bankaccountNewC);

            ////Assert
            Assert.AreEqual(1, testBankCustomer.Accounts.Length);
            CollectionAssert.AreEqual(isVipBankCustomer.Accounts, hasFourAccountsBankCustomer.Accounts);
        }
Пример #29
0
        public void Verify_VIP_Status_Works()
        {
            //create a bank account for a customer
            BankCustomer customer = new BankCustomer();

            BankAccount[] bankAccounts = customer.Accounts;

            BankAccount bank = new BankAccount();

            customer.AddAccount(bank, "TEST1");

            //deposit over 25000
            bank.Deposit(25001);



            //check status
            bool amAVIP = customer.IsVIP;

            Assert.IsTrue(customer.IsVIP);
        }
Пример #30
0
        public void TestSaveCustomerDetails()
        {
            BankCustomer user = new BankCustomer();

            user.BranchCode     = "TESTBRANCH";
            user.CanHaveAccount = "True";
            user.DateOfBirth    = "17/02/1991";
            user.Email          = "*****@*****.**";
            user.FullName       = "Nsubuga Kasozi";
            user.Gender         = "MALE";
            user.Id             = "100";
            user.IsActive       = "True";
            user.ModifiedBy     = "TEST";
            user.Password       = "******";
            user.PhoneNumber    = "256785975800";
            user.Usertype       = "CUSTOMER";

            Result result = client.SaveBankCustomerDetails(user, BankCode, Password);

            Assert.AreEqual(result.StatusCode, "0");
        }