Example #1
0
        public void TestQuestionEquitable()
        {
            var aGame = new GameTest();

            aGame.AddPlayer(new Player("Joueur 1"));
            aGame.AddPlayer(new Player("Joueur 2"));

            ConsoleMock.MockConsole("0");
            aGame.StartGame();

            for (int i = 0; i < 20000; i++)
            {
                aGame.ResetPlayerScore();
                aGame.Roll();
            }


            ConsoleMock.UnMockConsole();

            foreach (KeyValuePair <string, Dictionary <string, int> > entry in aGame.stats)
            {
                Debug.WriteLine($"Player: {entry.Key}");
                Debug.WriteLine("---------------------------");
                foreach (KeyValuePair <string, int> entryValue in entry.Value)
                {
                    Debug.WriteLine($"{entryValue.Key}: {entryValue.Value / (double) 20000 * 100}%");
                }
                Debug.WriteLine("===========================");
            }
        }
        public void SquareOf10By20ShouldBe200(int width, int height)
        {
            InputPlanner planner = new InputPlanner();

            planner.ScheduleLine(width.ToString());
            planner.ScheduleLine(height.ToString());
            using var consoleMock = new ConsoleMock();
            consoleMock.Schedule(planner);

            ReflectionHelper.ExecuteMain(subjectType);
            var expected = width * height;
            var actual   = consoleMock.ReadOutputLines().Last();

            Assert.AreEqual(expected.ToString(), actual, $"Площадь прямоугольника {width} x {height}. Ожидалось {expected}, но было {actual}");
        }
Example #3
0
 public void Setup()
 {
     consoleInteraction = new ConsoleMock();
     programFlow        = new ProgramFlow(consoleInteraction);
 }