private void visitGraveyardToolStripMenuItem_Click(object sender, EventArgs e) { StringBuilder cemetary = new StringBuilder(); lblDisplay.Text = string.Format("Cemetary of {0}", society.Name); List <string> graveyard = new List <string>(); society.GetGraveyard(out graveyard); graveyard.Sort((x, y) => x.CompareTo(y)); foreach (string s in graveyard) { cemetary.Append(s + "\n"); } UpdateDisplay(cemetary.ToString()); }
public void TestAdvanceAgeDeathAndGraveyard() { Creature cOne = new Creature(); Creature cTWo = new Creature(); Creature cThree = new Creature(); Creature cFour = new Creature(); Creature cFive = new Creature(); string NAME = "Balzeria"; string CLASSIFICATION = "Republic"; List <Creature> CREATURES = new List <Creature>() { cOne, cTWo, cThree, cFour, cFive }; Society society = new Society(NAME, CLASSIFICATION, CREATURES); List <Creature> creaturesList = new List <Creature>(); society.AdvanceAge(650); // 650 is the maximum age possible. List <string> graveyard = new List <string>(); Assert.IsTrue(society.GetGraveyard(out graveyard)); Assert.IsTrue(society.GetCreatures(out creaturesList)); /// If all creatures in the society die, 4 new random creatures should be populated Assert.AreEqual(4, creaturesList.Count); Assert.AreEqual(5, graveyard.Count); string DeathStringConfirmation = String.Format("{0}, Died at {1} years of age. Generation: {2}. Parents: {3} and {4}", cOne.Name, cOne.GetMaxAge(), cOne.Generation, cOne.ParentOne, cOne.ParentTwo); CollectionAssert.Contains(graveyard, DeathStringConfirmation); }