public void TestUpperSectionBonus() { DiceSet set = new DiceSet(new Random()); ScoreCard scoreCard = new ScoreCard(); { scoreCard.SLOT_ONES.Score = 62; int expected = 0; int actual = scoreCard.GetBonus(); Assert.AreEqual(expected, actual, "Failed upper test not bonus"); } { scoreCard.SLOT_ONES.Score = 63; int expected = 35; int actual = scoreCard.GetBonus(); Assert.AreEqual(expected, actual, "Failed upper test bonus"); } }
private void updateScoreCard() { ScoreCard card = yahtzeeGame.Player1State.ScoreCard; PlayerState player = yahtzeeGame.Player1State; updateScoreSlot("Ones", ScoreOnesLabel, ScoreOnesButton, card.SLOT_ONES, player); updateScoreSlot("Twos", ScoreTwosLabel, ScoreTwosButton, card.SLOT_TWOS, player); updateScoreSlot("Threes", ScoreThreesLabel, ScoreThreesButton, card.SLOT_THREES, player); updateScoreSlot("Fours", ScoreFoursLabel, ScoreFoursButton, card.SLOT_FOURS, player); updateScoreSlot("Fives", ScoreFivesLabel, ScoreFivesButton, card.SLOT_FIVES, player); updateScoreSlot("Sixes", ScoreSixesLabel, ScoreSixesButton, card.SLOT_SIXES, player); updateScoreSlot("Three Of Kind", ScoreThreeKindLabel, ScoreThreeKindButton, card.SLOT_THREE_OF_KIND, player); updateScoreSlot("Four of Kind", ScoreFourKindLabel, ScoreFourKindButton, card.SLOT_FOUR_OF_KIND, player); updateScoreSlot("Full House", ScoreFullHouseLabel, ScoreFullHouseButton, card.SLOT_FULL_HOUSE, player); updateScoreSlot("Small Straight", ScoreSmallStrLabel, ScoreSmallStrButton, card.SLOT_SMALL_STRAIGHT, player); updateScoreSlot("Large Straigt", ScoreLargeStrLabel, ScoreLargeStrButton, card.SLOT_LARGE_STRAIGHT, player); updateScoreSlot("Chance", ScoreChanceLabel, ScoreChanceButton, card.SLOT_CHANCE, player); updateScoreSlot("Yahtzee", ScoreYahtzeeLabel, ScoreYahtzeeButton, card.SLOT_YAHTZEE, player); ScoreSumLabel.Content = $"Sum: {card.GetUpperSum()}"; ScoreBonusLabel.Content = $"Bonus: {card.GetBonus()}"; ScoreTotalLabel.Content = $"Total: {card.GetTotalScore()}"; }