private void updateScoreSlot(String labelPrefix, Label scoreLabel, Button scoreButton, ScoreSlot slot, PlayerState state) { if (slot.Score.HasValue) { scoreLabel.Content = labelPrefix + ": " + slot.Score.Value; scoreButton.Visibility = Visibility.Hidden; } else { scoreLabel.Content = labelPrefix; if (state.CanScore()) { int potential = 0; scoreButton.Visibility = Visibility.Visible; if (slot.Qualifier(state.DiceSet)) { potential = slot.ScorePotential(state.DiceSet); } else { potential = 0; } scoreButton.Content = $"+{potential}"; } else { scoreButton.Visibility = Visibility.Hidden; } } }
private void TestUpperSectionSingle(DiceSet set, ScoreSlot slot, int digit) { { int expected = 4 * digit; set[0].Number = digit; set[1].Number = digit; set[2].Number = digit; set[3].Number = digit; set[4].Number = 0; int actual = slot.ScorePotential(set); Assert.AreEqual(expected, actual, "Failed upper test for " + digit); } }