Example #1
0
        public void TSTestGetTicker()
        {
            bool      expected = true;
            int       num      = 4;
            Ticker    tick     = new Ticker(4, 4);
            TickerSet tS       = new TickerSet(num, "Set Name");

            tS.addFull(tick);
            bool result = tS.getTicker(1);

            Assert.AreEqual(expected, result);
        }
Example #2
0
        public void TSTestNum()
        {
            int       expected = 4;
            int       num      = 4;
            Ticker    tick     = new Ticker(4, 4);
            TickerSet tS       = new TickerSet(num, "Set Name");

            tS.addFull(tick);



            tS.getTicker(1);
            int result = tS.getRetNum();

            Assert.AreEqual(expected, result);
        }
Example #3
0
        private void Add(object sender, RoutedEventArgs e)
        {
            if (cTS == null)
            {
                errorMessage("Slot is empty");
                return;
            }
            if (cTS.getName() == empty)
            {
                errorMessage("Slot is empty");
                return;
            }
            int amount, max, start;
            try
            {
                amount = Int32.Parse(amountRoll.Text);//Try to covert string to int for amount
            }
            catch
            {
                errorMessage("Amount is an illegal input");
                return;
            }
            if (amount <= 0)
            {
                errorMessage("Amount is less than or equal to 0 which is an illegal input");
                return;
            }

            try
            {
                max = Int32.Parse(maxNum.Text);//Try to covert string to int for max
            }
            catch
            {
                errorMessage("Max number is an illegal input");
                return;
            }
            if (max <= 0)
            {
                errorMessage("Max number is less than or equal to 0 which is an illegal input");
                return;
            }

            try
            {
                start = Int32.Parse(startNum.Text);//Try to covert string to int for start
            }
            catch
            {
                errorMessage("Starting number is an illegal input");
                return;
            }

            for (int i = 0; i < amount; i++)//Loop for each number in amout
            {
                if (cTS.size() >= size)//End loop if size of the current ticker set is greater the max size
                {
                    break;
                }

                common.Ticker tick = new common.Ticker(max, start);//Create ticker
                cTS.addTicker(tick);//Add ticker
                cTS.getTicker(i);//Get ticker
            }
            display();
            amountRoll.Text = "";
            maxNum.Text = "";
            startNum.Text = "";
            errorMessage("");
            memoryName();
            
        }