public void GivenADiceRoll_ThePlayerMovesThatManySpaces() { _dice.DiceRoll().Returns(1); var startingPosition = _player.CurrentSquare; _player.TakeTurn(); var endPosition = _player.CurrentSquare; endPosition.ShouldEqual(startingPosition + 1); }
public void TakeTurn() { var roll = _dice.DiceRoll(); if (CurrentSquare + roll <= EndingSquare) { CurrentSquare = CurrentSquare + roll; } }
private void SelectDice(string type, int number) { // Instantiate new Dice Interface _dice = new Adventurer(_username); // Set Total int total = 0; // Roll Dice According to Provided Amount & Type switch (type.ToLower()) { case "1": case "d4": total = _dice.DiceRoll(4, number); Console.WriteLine("You rolled a total of: " + total); break; case "2": case "d6": total = _dice.DiceRoll(6, number); Console.WriteLine("You rolled a total of: " + total); break; case "3": case "d8": total = _dice.DiceRoll(8, number); Console.WriteLine("You rolled a total of: " + total); break; case "4": case "d10": total = _dice.DiceRoll(10, number); Console.WriteLine("You rolled a total of: " + total); break; case "5": case "d12": total = _dice.DiceRoll(12, number); Console.WriteLine("You rolled a total of: " + total); break; case "6": case "d20": total = _dice.DiceRoll(20, number); Console.WriteLine("You rolled a total of: " + total); break; default: Validation.Resubmit("invalid input"); break; } }