Ejemplo n.º 1
0
        public void LotRowSuccess()
        {
            var maxLineLength = 10;
            var randomData    = new RandomData();

            var rowsCount = 1000000;
            var mcss      = new MovesConfigs();

            parser.Source = new string[rowsCount];
            for (int i = 0; i < rowsCount; i++)
            {
                var mcs = new MovesConfig();
                mcs.AddRange(randomData.GetMoves(maxLineLength));
                mcss.Add(mcs);

                var msSource = string.Join(" ", mcs);
                parser.Source[i] = msSource;
            }

            var mc = parser.ParseConfig();

            Assert.IsTrue(mc.Count == rowsCount);

            for (int i = 0; i < rowsCount; i++)
            {
                for (int j = 0; j < mc[i].Count; j++)
                {
                    Assert.AreEqual(mc[i][j], mcss[i][j]);
                }
            }
        }
Ejemplo n.º 2
0
        private Result Initialize()
        {
            try
            {
                _tableConfigParser.Source = _gameInputReader.GetTableConfig();
                _movesConfigParser.Source = _gameInputReader.GetMovesConfig();

                TableConfig  = _tableConfigParser.ParseConfig();
                MovesConfigs = _movesConfigParser.ParseConfig();

                TableConfig.Validate();

                _logger.BusinessSuccess(BL.EVENT_APPSTART_ID, BL.EVENT_APPSTART_NAME);

                return(new Result());
            }
            catch (ParseException pex)
            {
                _logger.BusinessFail(BL.EVENT_APPSTART_ID, BL.EVENT_APPSTART_NAME, pex);
                return(new ErrorResult {
                    ResultString = pex.Message
                });
            }
            catch (BusinessException bex)
            {
                _logger.BusinessFail(BL.EVENT_APPSTART_ID, BL.EVENT_APPSTART_NAME, bex);
                return(new ErrorResult {
                    ResultString = bex.Message
                });
            }
            catch (OutOfMemoryException oex)
            {
                _logger.BusinessFail(BL.EVENT_APPSTART_ID, BL.EVENT_APPSTART_NAME, oex);
                return(new ErrorResult {
                    ResultString = "Application is out of memory"
                });
            }
            catch (Exception ex)
            {
                _logger.PublishException(ex);
                return(new ErrorResult {
                    ResultString = "An error occured"
                });
            }
        }