public void CannotLockInScoreThatIsNotPartOfTheUpperSection() { var section = new LowerSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6, x => 7); section.Preview(new List <int>()); Assert.Throws <Exception>(() => section.Lock(ScoreCard.Items.Ones)); }
public void ReturnsScore() { var section = new LowerSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6, x => 7); section.Preview(new List <int>()); section.Lock(ScoreCard.Items.ThreeOfAKind); section.Preview(new List <int>()); section.Lock(ScoreCard.Items.FourOfAKind); section.Preview(new List <int>()); Assert.Equal(3, section.Score); }
public void PreviewsTheScoreForSetOfDice() { var section = new LowerSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6, x => 7); section.Preview(new List <int>()); Assert.Equal(1, section.ThreeOfAKind); Assert.Equal(2, section.FourOfAKind); Assert.Equal(3, section.FullHouse); Assert.Equal(4, section.SmallStraight); Assert.Equal(5, section.LongStraight); Assert.Equal(6, section.Chance); Assert.Equal(7, section.Yahtzee); }
public void LockInLongStraightScore() { var section = new LowerSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6, x => 7); section.Preview(new List <int>()); section.Lock(ScoreCard.Items.LongStraight); Assert.Equal(0, section.ThreeOfAKind); Assert.Equal(0, section.FourOfAKind); Assert.Equal(0, section.FullHouse); Assert.Equal(0, section.SmallStraight); Assert.Equal(5, section.LongStraight); Assert.Equal(0, section.Chance); Assert.Equal(0, section.Yahtzee); }
public static IDictionary <string, int> ScoreFullCard(Hand hand) { IDictionary <string, int> ScoreCard = new Dictionary <string, int>() { }; foreach (var val in LowerSection.GetValues(typeof(LowerSection))) { string section = val.ToString(); ScoreCard[section] = Score.ScoreHand(section, hand); } foreach (var val in UpperSection.GetValues(typeof(UpperSection))) { string section = val.ToString(); ScoreCard[section] = Score.ScoreHand(section, hand); } return(ScoreCard); }