Example #1
0
        private void Authentication()
        {
            BankAuthentication bankAuthentication = new BankAuthentication(this.CurURL, this.CurUserName, this.CurPassword, this.CurVaultGuid);

            BankFunc.URL            = this.CurURL;
            BankFunc.Authentication = bankAuthentication.Authentication;
        }
        public void AttemptsTest()
        {
            List <Card> cards = new List <Card>();

            /*Card 1*/
            Card one = new Card();

            one.CardNumber = "12345";
            one.Pin        = "2244";

            /*Add cards to the list*/
            cards.Add(one);

            for (int i = 0; i < cards.Count; i = i + 1)
            {
                cards[i].PasswordAttempts = 3;
            }

            BankAuthentication auth = new BankAuthentication(cards);

            auth.Authenticate("12345", "0010");
            auth.Authenticate("12345", "0010");
            auth.Authenticate("12345", "0010");

            Assert.AreEqual(auth.Authenticate("12345", "2244"), false);
        }
        public void WrongUsernameTest()
        {
            List <Card> cards = new List <Card>();

            /*Card 1*/
            Card one = new Card();

            one.CardNumber = "12345";
            one.Pin        = "2244";

            /*Card 2*/
            Card two = new Card();

            two.CardNumber = "24680";
            two.Pin        = "0011";

            /*Card 3*/
            Card three = new Card();

            three.CardNumber = "98765";
            three.Pin        = "2468";

            /*Add cards to the list*/
            cards.Add(one);
            cards.Add(two);
            cards.Add(three);

            for (int i = 0; i < cards.Count; i = i + 1)
            {
                cards[i].PasswordAttempts = 3;
            }

            BankAuthentication auth = new BankAuthentication(cards);

            Assert.AreEqual(auth.Authenticate("10101", "0011"), false);
        }
Example #4
0
        public BSLController()
        {
            cards = GlobalData.list;
            if (cards == null)
            {
                cards = new List <Card>();

                /*Card 1*/
                Card one = new Card();
                one.CardNumber = "12345";
                one.Pin        = "2244";
                one.Reported   = true;

                /*Card 2*/
                Card two = new Card();
                two.CardNumber = "24680";
                two.Pin        = "0011";
                two.Reported   = false;

                /*Card 3*/
                Card three = new Card();
                three.CardNumber = "98765";
                three.Pin        = "2468";
                three.Reported   = false;

                /*Add cards to the list*/
                cards.Add(one);
                cards.Add(two);
                cards.Add(three);

                List <BankAccount> cardOne = new List <BankAccount>();
                BankAccount        a       = new BankAccount("savings", 10000);
                BankAccount        b       = new BankAccount("back up", 20000);
                cardOne.Add(a);
                cardOne.Add(b);
                one.LinkedBankAccount = cardOne;

                List <BankAccount> cardTwo = new List <BankAccount>();
                BankAccount        c       = new BankAccount("savings", 5000);
                BankAccount        d       = new BankAccount("keletso", 10000);
                cardTwo.Add(c);
                cardTwo.Add(d);
                two.LinkedBankAccount = cardTwo;

                List <BankAccount> cardThree = new List <BankAccount>();
                BankAccount        e         = new BankAccount("savings", 200);
                BankAccount        f         = new BankAccount("kids", 500);
                cardThree.Add(e);
                cardThree.Add(f);
                three.LinkedBankAccount = cardThree;

                for (int i = 0; i < cards.Count; i = i + 1)
                {
                    cards[i].PasswordAttempts = 3;
                }

                GlobalData.list = cards;
            }

            security = new BankAuthentication(cards);
        }