public void It_Should_Return_SumOfThreeDiceWithTheSameNumber_When_GivenFourOfAKind() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(3), new EchoDie(3), new EchoDie(3), new EchoDie(3), new EchoDie(5), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var threeOfAKindCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.ThreeOfAKind, turn.Dice); //Assert Assert.Equal(9, threeOfAKindCalculator.Calculate()); }
public void It_Should_Return_SumOfTwoPairs_When_GivenPairsAndThreeOfAKind() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(2), new EchoDie(2), new EchoDie(2), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var twoPairsCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.TwoPairs, turn.Dice); //Assert Assert.Equal(6, twoPairsCalculator.Calculate()); }
public void It_Should_Return_SumOfZero_When_NotGivenFourOfAKind() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(2), new EchoDie(2), new EchoDie(2), new EchoDie(5), new EchoDie(5), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var fourOfAKindCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.FourOfAKind, turn.Dice); //Assert Assert.Equal(0, fourOfAKindCalculator.Calculate()); }
public void It_Should_Return_SumOfPairs_When_FourOfAKindIsGiven() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(3), new EchoDie(3), new EchoDie(3), new EchoDie(1), new EchoDie(1), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var pairsCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Pairs, turn.Dice); //Assert Assert.Equal(6, pairsCalculator.Calculate()); }
public void It_Should_Return_SumOfAllDice_When_GivenASmallStraight() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(2), new EchoDie(3), new EchoDie(4), new EchoDie(5), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var smallStraightsCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.SmallStraights, turn.Dice); //Assert Assert.Equal(15, smallStraightsCalculator.Calculate()); }
public void It_Should_Return_SumOfFourDiceWithTheSameNumber_When_GivenFourOfAKind() { var fiveMockDice = new List <IDie> { new EchoDie(2), new EchoDie(2), new EchoDie(2), new EchoDie(5), new EchoDie(2), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //TODO: is this okay that it's no longer required, could just pass in fiveMockDice below //Act var fourOfAKindCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.FourOfAKind, turn.Dice); //Assert Assert.Equal(8, fourOfAKindCalculator.Calculate()); }
public void It_Should_Return_Zero_When_NotGivenALargeStraight() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(2), new EchoDie(3), new EchoDie(4), new EchoDie(5), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var largeStraightsCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.LargeStraights, turn.Dice); //Assert Assert.Equal(0, largeStraightsCalculator.Calculate()); }
public void It_Should_Return_SumOfAllDice_When_GivenFullHouse() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(2), new EchoDie(2), new EchoDie(2), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var fullHouseCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.FullHouse, turn.Dice); //Assert Assert.Equal(8, fullHouseCalculator.Calculate()); }
public void It_Should_Return_SumOfThrees_When_PlacedOnThrees_And_GivenThrees() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(3), new EchoDie(3), new EchoDie(2), new EchoDie(3), new EchoDie(3), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var threesCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Threes, turn.Dice); //Assert Assert.Equal(12, threesCalculator.Calculate()); }
public void It_Should_Return_SumOfZero_When_PlacedOnOnes_NotGivenOnes() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(3), new EchoDie(3), new EchoDie(4), new EchoDie(4), new EchoDie(5), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var onesCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Ones, turn.Dice); //Assert Assert.Equal(0, onesCalculator.Calculate()); }
public void It_Should_Return_SumOfSixes_When_PlacedOnSix_And_GivenSix() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(6), new EchoDie(1), new EchoDie(2), new EchoDie(4), new EchoDie(4), }; var turn = new Turn(fiveMockDice); //turn.RollDice(); //Act var sixesCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Sixes, turn.Dice); //Assert Assert.Equal(6, sixesCalculator.Calculate()); }
public void It_Should_Return_Zero_When_GivenOnePair() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(2), new EchoDie(3), new EchoDie(4), }; var turn = new Turn(fiveMockDice); turn.RollDice(); //Act var twoPairsCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.TwoPairs, turn.Dice); //Assert Assert.Equal(0, twoPairsCalculator.Calculate()); }
public void It_Should_ReturnSumOfAllDice_When_GivenFiveDice() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(3), new EchoDie(3), new EchoDie(6), }; var turn = new Turn(fiveMockDice); turn.RollDice(); //Act var calculateChance = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Chance, turn.Dice); //Assert Assert.Equal(14, calculateChance.Calculate()); }
public void It_Should_Return_0_When_GivenFiveDiceOfNotTheSameValue() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(1), new EchoDie(2), new EchoDie(1), }; var turn = new Turn(fiveMockDice); turn.RollDice(); //Act var yatzyCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Yatzy, turn.Dice); //Assert Assert.Equal(0, yatzyCalculator.Calculate()); }
public void It_Should_Return_SumOfFours_When_PlacedOnFours_And_GivenFours() { //Arrange var fiveMockDice = new List <IDie> { new EchoDie(1), new EchoDie(1), new EchoDie(2), new EchoDie(4), new EchoDie(4), }; var turn = new Turn(fiveMockDice); turn.RollDice(); //Act var foursCalculator = CategoryCalculatorFactory.CreateCalculator(ScoreCategory.Fours, turn.Dice); //Assert Assert.Equal(8, foursCalculator.Calculate()); }
private int GetScoreForCategory(ScoreCategory scoreCategory, List <IDie> diceHeld) { var categoryCalculator = CategoryCalculatorFactory.CreateCalculator(scoreCategory, diceHeld); return(categoryCalculator.Calculate()); }