public void RemoveTest() { Doll cloneDorothy = dorothy.Copy(); // Doll with several accessories. Dress dorothyDress = pinkPartyDress.Copy() as Dress; Purse dorothyPurse = premiumPurse.Copy() as Purse; Necklace dorothyNecklace = diamondNecklace.Copy() as Necklace; Bracelet dorothyBraceletA = braidedBracelet.Copy() as Bracelet; Bracelet dorothyBraceletB = diamondBracelet.Copy() as Bracelet; Bracelet dorothyBraceletC = fantasyBraceletA.Copy() as Bracelet; Bracelet dorothyBraceletD = fantasyBraceletB.Copy() as Bracelet; cloneDorothy.Wear(dorothyDress); cloneDorothy.Wear(dorothyPurse); cloneDorothy.Wear(dorothyNecklace); cloneDorothy.Wear(dorothyBraceletA); cloneDorothy.Wear(dorothyBraceletB); cloneDorothy.Wear(dorothyBraceletC); cloneDorothy.Wear(dorothyBraceletD); // Removing a doll's dress will remove all accessories at once. cloneDorothy.Remove(dorothyDress); Assert.AreEqual(cloneDorothy.TotalAccessories, 0); }
private static void Main(string[] args) { //System.Console.ReadLine(); PageantJury ConcursoPrueba = new PageantJury(); Doll doll = new Doll("2Pac"); Accessory vestido = new Dress(15, Dress.EColor.Black, Dress.EDressCategory.Casual); doll.Wear(vestido); Accessory accesorio = new Necklace(20000); doll.Wear(accesorio); doll.Remove(vestido); ConcursoPrueba.AddContestant(doll); doll = new Doll("Snoop Dog"); accesorio = new Dress(10, Dress.EColor.White, Dress.EDressCategory.Suit); doll.Wear(accesorio); accesorio = new Necklace(60); doll.Wear(accesorio); accesorio = new Bracelet(160); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); doll = new Doll("Mexicano 777"); accesorio = new Dress(25, Dress.EColor.Pink, Dress.EDressCategory.Party); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); doll = new Doll("El judio"); accesorio = new Dress(5, Dress.EColor.Green, Dress.EDressCategory.Casual); doll.Wear(accesorio); accesorio = new Bracelet(700); doll.Wear(accesorio); ConcursoPrueba.AddContestant(doll); if (ConcursoPrueba.GetWinner() == null) { System.Console.WriteLine("Sin ganador"); } else { System.Console.WriteLine("ganador = " + ConcursoPrueba.GetWinner().Name); } System.Console.WriteLine("Pulse enter para salir"); System.Console.ReadLine(); }