public void TestYahtzee_MultiUseCategory_ThrowsException() { DieSet dieSet = new DieSet(1, 1, 2, 3, 1); ScoringCategory yahtzee = new YahtzeeCategory(); int score = yahtzee.Score(dieSet.getCount()); score = yahtzee.Score(dieSet.getCount()); }
public void TestYahtzeeNoScore() { DieSet die = new DieSet(6, 6, 6, 6, 5); ScoringCategory yahtzee = new YahtzeeCategory(); int score = yahtzee.CalculateScoreForRoll(die.getCount()); Assert.IsTrue(score == 0); }
public void TestScoreYahtzee() { DieSet die = new DieSet(1, 1, 1, 1, 1); ScoringCategory yahtzee = new YahtzeeCategory(); Assert.IsTrue(yahtzee.Name == "Yahtzee"); Assert.IsTrue(yahtzee.HasBeenUsed == false); Assert.IsTrue(yahtzee.Lower); Assert.IsFalse(yahtzee.Upper); yahtzee.Score(die.getCount()); Assert.IsTrue(yahtzee.HasBeenUsed == true); Assert.IsTrue(yahtzee.FinalScore == 50); }
public int Score(YahtzeeCategory category, params int[] dice) { if (category == YahtzeeCategory.Chance) return dice.Sum(); if (category == YahtzeeCategory.Ones) return SumDiceWithEye(dice, 1); if (category == YahtzeeCategory.Twos) return SumDiceWithEye(dice, 2); if (category == YahtzeeCategory.Three) return SumDiceWithEye(dice, 3); if (category == YahtzeeCategory.Fours) return SumDiceWithEye(dice, 4); if (category == YahtzeeCategory.Fives) return SumDiceWithEye(dice, 5); if (category == YahtzeeCategory.Sixes) return SumDiceWithEye(dice, 6); if (category == YahtzeeCategory.Pair) return SumHighestPair(dice); if (category == YahtzeeCategory.TwoPair) return SumTwoPairs(dice); return 0; }
public void GetSelectedCategory_WhenInputIsValid_ReturnsCategory(string input, YahtzeeCategory expected) { var actual = _sut.GetSelectedCategory(input); Assert.AreEqual(expected, actual); }
private void AssertScore(YahtzeeCategory category, int dice1, int dice2, int dice3, int dice4, int dice5, int expectedScore) { var actualScore = yahtzee.Score(category, dice1, dice2, dice3, dice4, dice5); Assert.AreEqual(expectedScore, actualScore); }
public void TestYahtzeeRules() { ScoringCategory yahtzee = new YahtzeeCategory(); Assert.AreEqual("Yahtzee: If all dice show the same value, score 50. Otherwise, score 0.", yahtzee.getRules()); }