Example #1
0
        public void CharacterizationTest()
        {
            foreach (var fullFileName in Directory.GetFiles(@".\TestData\"))
            {
                var outputWriter = new TestOutputWriter();
                var fileName     = Path.GetFileName(fullFileName);

                GameRunner.Main(new[] { fileName }, outputWriter);

                Assert.That(outputWriter.Output, Is.EqualTo(File.ReadAllText(fullFileName)));
            }
        }
Example #2
0
        public static void Main(String[] args)
        {
            var triviaGame = new TriviaGame();

            triviaGame.AddPlayer("Chet");
            triviaGame.AddPlayer("Pat");
            triviaGame.AddPlayer("Sue");

            var random = (args.Length == 0 ? new WrappedRandom() : new WrappedRandom(args[0].GetHashCode()));
            var turnDie = new NSidedDie(6, random);

            var gameRunner = new GameRunner();

            gameRunner.PlayGame(triviaGame, turnDie, new QuestionAnswerer(random));
        }
Example #3
0
        public static void Main(string[] args)
        {
            var rand = args.Length > 0 && int.TryParse(args[0], out var seed)
                ? new Random(seed)
                : new Random();

            var dice = new Dice();
            var consoleGameLogger = new ConsoleGameLogger();
            var defaultRegion     = new DefaultGameRegion();

            var game = new Game(consoleGameLogger, defaultRegion);
            var randomAnsweringStrategy = new ConsoleAnsweringStrategy();

            var gameRunner = new GameRunner(dice, randomAnsweringStrategy, rand, game);

            gameRunner.Start();
        }
Example #4
0
        public static void Main(string[] args)
        {
            var rand = args.Length > 0 && int.TryParse(args[0], out var seed)
                ? new Random(seed)
                : new Random();

            var dice = new Dice();
            var consoleGameLogger = new ConsoleGameLogger();
            var categorySelector  = new CategorySelector();
            var questionFactory   = new QuestionFactory();

            var game = new Game(consoleGameLogger, categorySelector, questionFactory);
            var randomAnsweringStrategy = new ConsoleAnsweringStrategy();

            var gameRunner = new GameRunner(dice, randomAnsweringStrategy, rand, game);

            gameRunner.Start();
        }
        static void RunOneThousandGames()
        {
            var original = Console.Out;

            try
            {
                using (var writer = File.CreateText(ActualFile))
                {
                    Console.SetOut(writer);
                    for (var i = 0; i < 1000; i++)
                    {
                        var seed = 34728 + 17 * i;
                        GameRunner.Run(new Random(seed));
                    }
                }
            }
            finally
            {
                Console.SetOut(original);
            }
        }
Example #6
0
        public static void Main(String[] args)
        {
            var gameRunner = new GameRunner();

            gameRunner.RunGame(Console.Out, 0);
        }
Example #7
0
        public static void Main(String[] args)
        {
            var gameRunner = new GameRunner();

            gameRunner.PlayGame(new Random());
        }
Example #8
0
        public static void Main(String[] args)
        {
            var gameRunner = new GameRunner();

            gameRunner.RunGame(Console.Out, 0);
        }
Example #9
0
        public static void Main(String[] args)
        {
            var runner = new GameRunner(new Random());

            runner.DoMain(args);
        }
Example #10
0
 static void Main(string[] args)
 {
     GameRunner.main(new String[2]);
     System.Console.ReadKey();
 }