public void DecorateProductWithStickerTest() { IStatue stickerBaseStatue = new StickerDecorator(_baseStatue); _descriptionWords = stickerBaseStatue.GetDescription().Split(); //Sticker will be added after the word "Statue" Assert.IsTrue(Enum.IsDefined(typeof(Stickers), _descriptionWords[1])); }
/// <summary> /// Creates a product and returns it /// </summary> /// <param name="numberOfDecorations"> /// How many decorations to have on statue /// </param> /// <returns> /// IStatue Returns a product /// </returns> public IStatue CreateProduct(int numberOfDecorations) { IStatue statue = new Statue(); for (var i = 0; i < numberOfDecorations; i++) { var value = Client.Rnd.Next(1, 4); switch (value) { case 1: if (CanUseDecoration(statue.GetDescription(), "jewel")) { var jewelDecoratedStatue = new JewelDecorator(statue); statue = jewelDecoratedStatue; break; } i--; break; case 2: if (CanUseDecoration(statue.GetDescription(), "sticker")) { var stickerDecoratedStatue = new StickerDecorator(statue); statue = stickerDecoratedStatue; break; } i--; break; case 3: if (CanUseDecoration(statue.GetDescription(), "color")) { var colorDecoratedStatue = new ColorDecorator(statue); statue = colorDecoratedStatue; break; } i--; break; } } return(statue); }