コード例 #1
0
    private void OnPlayerMovementSelected(Movement movementInstance)
    {
        Movement    cpuMovement = movementGenerator.GenerateMovement();
        RoundResult result      = movementInstance.GetResult(cpuMovement);

        UpdateScore(result);
    }
コード例 #2
0
        public void GeneratesRandomMovement()
        {
            MovementGenerator cpu = new MovementGenerator();
            Movement          generatedMovement = cpu.GenerateMovement();

            Assert.IsNotNull(generatedMovement);
            Assert.IsInstanceOf <Movement> (generatedMovement);
        }
コード例 #3
0
        public void SetUp()
        {
            ui        = new MyUITest();
            displayer = Substitute.For <ScoreDisplayer> ();

            cpu = Substitute.For <MovementGenerator> ();
            cpu.GenerateMovement().Returns(new Rock());

            game = new Game(ui, displayer, cpu);
        }
コード例 #4
0
        public void CountPlayerWins()
        {
            cpu.GenerateMovement().Returns(new Paper());
            ui.Selected(new Scissors());

            cpu.GenerateMovement().Returns(new Paper());
            ui.Selected(new Scissors());

            cpu.GenerateMovement().Returns(new Scissors());
            ui.Selected(new Paper());

            Assert.AreEqual(2, game.PlayerScore);
        }