Ejemplo n.º 1
0
        public void ManualGameMutilpeRolls()
        {
            var frameOneTotal = 26;
            var frameTwoTotal = 19;
            var score         = 54;

            var game = new ManualGame();

            game.Roll(new Roll()
            {
                PinsBowled = 10, RollType = RollType.Strike
            });
            game.Roll(new Roll()
            {
                PinsBowled = 8, RollType = RollType.Normal
            });
            game.Roll(new Roll()
            {
                PinsBowled = 8, RollType = RollType.Normal
            });
            game.Roll(new Roll()
            {
                PinsBowled = 2, RollType = RollType.Spare
            });
            game.Roll(new Roll()
            {
                PinsBowled = 9, RollType = RollType.Normal
            });

            Assert.AreEqual(score, game.Score, $@"Expected score {score} Game score {game.Score}");
            Assert.AreEqual(frameOneTotal, game.Frames[0].Total, $@"Expected total {frameOneTotal} Frame total {game.Frames[0].Total}");
            Assert.AreEqual(frameTwoTotal, game.Frames[1].Total, $@"Expected total {frameTwoTotal} Frame total {game.Frames[1].Total}");
        }
Ejemplo n.º 2
0
        public void CreateManualGameWithPlayerName()
        {
            var playerName = "Kris";
            var manualPlay = PlayMode.Manual;

            var game = new ManualGame("Kris");

            Assert.AreEqual(playerName, game.PlayerName, $@"The player for this game isn't {playerName}");
            Assert.AreEqual(manualPlay, game.PlayMode, "Game play type isn't set to manual mode.");
        }
Ejemplo n.º 3
0
        public void ManualBowlNoPinsSent()
        {
            var pinsBowled = 0;

            var game = new ManualGame();

            var roll = game.Bowl();

            Assert.AreEqual(pinsBowled, roll.PinsBowled, $@"Expected Pins Bowled {pinsBowled}, Actual Pins Bowled {roll.PinsBowled}");
        }
Ejemplo n.º 4
0
        public void CreateManualGamePlay()
        {
            // Arrange
            var manualPlay = PlayMode.Manual;

            // Act
            var game = new ManualGame();

            // Assert
            Assert.AreEqual(manualPlay, game.PlayMode, "Game play type isn't set to manual mode.");
        }
Ejemplo n.º 5
0
        public void ManualGameNoExtraRoll_GameIsFinished()
        {
            var isFinished = true;

            var game = new ManualGame();

            for (int i = 0; i < 20; i++)
            {
                game.PinsBowled = 4;
                game.Bowl();
            }

            Assert.AreEqual(isFinished, game.IsFinished, $@"Expected Game Finished {isFinished}, Actual Game Finished {game.IsFinished}");
        }
Ejemplo n.º 6
0
        public void PerfectManualGame()
        {
            var score = 300;

            var game = new ManualGame();

            for (var i = 0; i < 21; i++)
            {
                game.Roll(new Roll()
                {
                    RollType = RollType.Strike, PinsBowled = 10
                });
            }

            Assert.AreEqual(score, game.Score, $@"Expected score {score} Game score {game.Score}");
        }
 private void Awake()
 {
     if (transform.gameObject.name == "redBall12_8")
     {
         previousPosition = new Vector2(transform.parent.position.x - 720f, transform.parent.position.y - 480f);
         game_dimension   = "12x8";
     }
     else if (transform.gameObject.name == "redBall16_9")
     {
         previousPosition = new Vector2(transform.parent.position.x - 960f, transform.parent.position.y - 540f);
         game_dimension   = "16x9";
     }
     else if (transform.gameObject.name == "redBall8_6")
     {
         previousPosition = new Vector2(transform.parent.position.x - 480f, transform.parent.position.y - 360f);
         game_dimension   = "8x6";
     }
     man = manualGameObj.GetComponent <ManualGame>();
 }
Ejemplo n.º 8
0
        public void EnterPinsKnockedDown()
        {
            var bowl1           = 10;
            var bowl2           = 8;
            var bowl3           = 8;
            var bowl4           = 2;
            var bowl5           = 9;
            var bowl6           = 0;
            var score           = 54;
            var frameOneTotal   = 26;
            var frameTwoTotal   = 19;
            var frameThreeTotal = 9;

            var game = new ManualGame();

            game.PinsBowled = bowl1;
            game.Bowl();

            game.PinsBowled = bowl2;
            game.Bowl();

            game.PinsBowled = bowl3;
            game.Bowl();

            game.PinsBowled = bowl4;
            game.Bowl();

            game.PinsBowled = bowl5;
            game.Bowl();

            game.PinsBowled = bowl6;
            game.Bowl();

            Assert.AreEqual(score, game.Score, $@"Expected score {score} Game score {game.Score}");
            Assert.AreEqual(frameOneTotal, game.Frames[0].Total, $@"Expected total {frameOneTotal} Frame total {game.Frames[0].Total}");
            Assert.AreEqual(frameTwoTotal, game.Frames[1].Total, $@"Expected total {frameTwoTotal} Frame total {game.Frames[1].Total}");
            Assert.AreEqual(frameThreeTotal, game.Frames[2].Total, $@"Expected total {frameThreeTotal} Frame total {game.Frames[2].Total}");
        }