private void SetupYatzy() { ScoringCategoryFactory factory = new ScoringCategoryFactory(); ScoringCategories.Add(factory.makeCategory("Ones")); ScoringCategories.Add(factory.makeCategory("Twos")); ScoringCategories.Add(factory.makeCategory("Threes")); ScoringCategories.Add(factory.makeCategory("Fours")); ScoringCategories.Add(factory.makeCategory("Fives")); ScoringCategories.Add(factory.makeCategory("Sixes")); ScoringCategories.Add(factory.makeCategory("One Pair")); ScoringCategories.Add(factory.makeCategory("Two Pairs")); ScoringCategories.Add(factory.makeCategory("Three of a Kind Alt")); ScoringCategories.Add(factory.makeCategory("Four of a Kind Alt")); ScoringCategories.Add(factory.makeCategory("Full House Alt")); ScoringCategories.Add(factory.makeCategory("Small Straight")); ScoringCategories.Add(factory.makeCategory("Large Straight")); ScoringCategories.Add(factory.makeCategory("Yahtzee")); ScoringCategories.Add(factory.makeCategory("Chance")); Bonus = 0; useBonus = true; bonusThreshold = 63; bonusAmount = 50; jokerRules = false; BonusYahtzeeAmount = 0; }
private void SetupYacht() { ScoringCategoryFactory factory = new ScoringCategoryFactory(); ScoringCategories.Add(factory.makeCategory("Ones")); ScoringCategories.Add(factory.makeCategory("Twos")); ScoringCategories.Add(factory.makeCategory("Threes")); ScoringCategories.Add(factory.makeCategory("Fours")); ScoringCategories.Add(factory.makeCategory("Fives")); ScoringCategories.Add(factory.makeCategory("Sixes")); ScoringCategories.Add(factory.makeCategory("Four of a Kind Alt")); ScoringCategories.Add(factory.makeCategory("Full House Alt")); ScoringCategories.Add(factory.makeCategory("Little Straight")); ScoringCategories.Add(factory.makeCategory("Big Straight")); ScoringCategory cat = factory.makeCategory("Yahtzee"); cat.Name = "Yacht"; ScoringCategories.Add(cat); cat = factory.makeCategory("Chance"); cat.Name = "Choice"; ScoringCategories.Add(cat); Bonus = 0; useBonus = false; bonusThreshold = 0; bonusAmount = 0; jokerRules = false; BonusYahtzeeAmount = 0; }
public void testFactoryBadName() { ScoringCategoryFactory factory = new ScoringCategoryFactory(); factory.makeCategory("Bad Name"); }
// will likely end up refactoring this to factory at some point, but for now // this code will create a standard Yahtzee score sheet private void SetupStandard() { ScoringCategoryFactory factory = new ScoringCategoryFactory(); ScoringCategory cat = factory.makeCategory("Ones"); cat.Name = "Aces"; ScoringCategories.Add(cat); ScoringCategories.Add(factory.makeCategory("Twos")); ScoringCategories.Add(factory.makeCategory("Threes")); ScoringCategories.Add(factory.makeCategory("Fours")); ScoringCategories.Add(factory.makeCategory("Fives")); ScoringCategories.Add(factory.makeCategory("Sixes")); ScoringCategories.Add(factory.makeCategory("Three of a Kind")); ScoringCategories.Add(factory.makeCategory("Four of a Kind")); ScoringCategories.Add(factory.makeCategory("Full House")); ScoringCategories.Add(factory.makeCategory("Small Straight")); ScoringCategories.Add(factory.makeCategory("Large Straight")); ScoringCategories.Add(factory.makeCategory("Yahtzee")); ScoringCategories.Add(factory.makeCategory("Chance")); Bonus = 0; useBonus = true; bonusThreshold = 63; bonusAmount = 35; jokerRules = true; BonusYahtzeeAmount = 100; }
public void testFactory() { ScoringCategoryFactory factory = new ScoringCategoryFactory(); ScoringCategory cat; cat = factory.makeCategory("Ones"); Assert.AreEqual("Ones", cat.Name); cat = factory.makeCategory("Twos"); Assert.AreEqual("Twos", cat.Name); cat = factory.makeCategory("Threes"); Assert.AreEqual("Threes", cat.Name); cat = factory.makeCategory("Fours"); Assert.AreEqual("Fours", cat.Name); cat = factory.makeCategory("Fives"); Assert.AreEqual("Fives", cat.Name); cat = factory.makeCategory("Sixes"); Assert.AreEqual("Sixes", cat.Name); cat = factory.makeCategory("Three of a Kind"); Assert.AreEqual("Three of a Kind", cat.Name); Assert.IsInstanceOf(typeof(ThreeOfAKindCategory), cat); cat = factory.makeCategory("Four of a Kind"); Assert.AreEqual("Four of a Kind", cat.Name); Assert.IsInstanceOf(typeof(FourOfAKindCategory), cat); cat = factory.makeCategory("Full House"); Assert.AreEqual("Full House", cat.Name); Assert.IsInstanceOf(typeof(FullHouseCategory), cat); cat = factory.makeCategory("Small Straight"); Assert.AreEqual("Small Straight", cat.Name); Assert.IsInstanceOf(typeof(SmallStraightCategory), cat); cat = factory.makeCategory("Large Straight"); Assert.AreEqual("Large Straight", cat.Name); Assert.IsInstanceOf(typeof(LargeStraightCategory), cat); cat = factory.makeCategory("Yahtzee"); Assert.AreEqual("Yahtzee", cat.Name); cat = factory.makeCategory("Chance"); Assert.AreEqual("Chance", cat.Name); cat = factory.makeCategory("Big Straight"); Assert.AreEqual("Big Straight", cat.Name); cat = factory.makeCategory("Four of a Kind Alt"); Assert.IsInstanceOf(typeof(FourOfAKindAltCategory), cat); Assert.AreEqual("Four of a Kind", cat.Name); cat = factory.makeCategory("Full House Alt"); Assert.IsInstanceOf(typeof(FullHouseAltCategory), cat); Assert.AreEqual("Full House", cat.Name); cat = factory.makeCategory("Large Straight Alt"); Assert.IsInstanceOf(typeof(LargeStraightAltCategory), cat); Assert.AreEqual("Large Straight", cat.Name); cat = factory.makeCategory("Little Straight"); Assert.AreEqual("Little Straight", cat.Name); cat = factory.makeCategory("One Pair"); Assert.AreEqual("One Pair", cat.Name); cat = factory.makeCategory("Small Straight Alt"); Assert.IsInstanceOf(typeof(SmallStraightAltCategory), cat); Assert.AreEqual("Small Straight", cat.Name); cat = factory.makeCategory("Three of a Kind Alt"); Assert.IsInstanceOf(typeof(ThreeOfAKindAltCategory), cat); Assert.AreEqual("Three of a Kind", cat.Name); cat = factory.makeCategory("Two Pairs"); Assert.AreEqual("Two Pairs", cat.Name); }