예제 #1
0
        public static void UnleashChaos(Settings settings, ChaosLogger logger)
        {
            if (settings.Repeat == 0)
            {
                settings.Repeat = 1;
            }

            if (settings.Repeat > 1)
            {
                logger.Log(string.Format("Repeating {0} times", settings.Repeat));
            }
            MonkeyKeeper keeper = new MonkeyKeeper(settings, logger, new HardCodedMonkeyListBuilder());
            for (var times = 0; times < settings.Repeat; times++)
            {
                keeper.UnleashRandomMonkey();
                if (settings.Delay <= 0) return;
                logger.Log(string.Format("Waiting {0} ms", settings.Delay));
                System.Threading.Thread.Sleep(settings.Delay);
            }
        }
예제 #2
0
        public static void UnleashChaos(Settings settings, ChaosLogger logger)
        {
            if (settings.Repeat == 0)
            {
                settings.Repeat = 1;
            }

            if (settings.Repeat > 1)
            {
                logger.Log(string.Format("Repeating {0} times", settings.Repeat));
            }
            MonkeyKeeper keeper = new MonkeyKeeper(settings, logger, new HardCodedMonkeyListBuilder());

            for (var times = 0; times < settings.Repeat; times++)
            {
                keeper.UnleashRandomMonkey();
                if (settings.Delay <= 0)
                {
                    return;
                }
                logger.Log(string.Format("Waiting {0} ms", settings.Delay));
                System.Threading.Thread.Sleep(settings.Delay);
            }
        }