public void Detach(Shop shop)
        {
            shops.Remove(shop);

            if (priceNotifier == null)
                return;
            priceNotifier -= new Notifier(shop.Update);
        }
        public void check_all_the_shops_notified_with_latest_price()
        {
            Book yaanaBook = new Book();

            Shop jayangarShop = new Shop("Jayanagar Shop");
            yaanaBook.Attach(jayangarShop);
            Shop jpNagarShop = new Shop("JP Nagar Shop");
            yaanaBook.Attach(jpNagarShop);
            Shop krRoadShop = new Shop("KR Road Shop");
            yaanaBook.Attach(krRoadShop);

            decimal latestPrice = 250m;
            yaanaBook.UpdatePrice(latestPrice);

            Assert.AreEqual(latestPrice, jayangarShop.Price);
            Assert.AreEqual(latestPrice, jpNagarShop.Price);
            Assert.AreEqual(latestPrice, krRoadShop.Price);
        }
 public void Attach(Shop shop)
 {
     shops.Add(shop);
     priceNotifier += new Notifier(shop.Update);
 }