コード例 #1
0
        public void CountTicketsPiterAlgorithmTest(int maxlimit, int expectedCount)
        {
            TicketCounter counter = new TicketCounter(new PiterAlgorithm());
            int           actualTicketCounts;

            //Act
            actualTicketCounts = counter.CountTickets((uint)maxlimit);

            //Assert
            Assert.AreEqual(expectedCount, actualTicketCounts);
        }
コード例 #2
0
        private void AddAlgorithmCountersToList(ILuckyTicketCounterAlgorithm[] _algorithmsArr)
        {
            uint          limit          = 0;
            TicketCounter _ticketCounter = null;

            foreach (ILuckyTicketCounterAlgorithm algorithm in _algorithmsArr)
            {
                _viewer.ShowMessage(algorithm.ToString());

                _ticketCounter = new TicketCounter(algorithm);

                limit = GetAlgorithmTicketMaxLimit(algorithm.ToString());

                if (limit == 0)
                {
                    limit = DEFAULT_LIMIT;
                }

                _ticketCounter.CountTickets(limit);

                _counters.Add(_ticketCounter);
            }
        }