コード例 #1
0
        public void GetItem_WhenMissingItemName()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            Assert.ThrowsException <ArgumentNullException>(() =>
            {
                store.GetItem(deptName: "Merchandise", itemName: null);
            });
        }
コード例 #2
0
        public void GetItem_WhenInvalidPrice()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            Assert.ThrowsException <InvalidPriceException>(() =>
            {
                store.GetItem(deptName: "Snacks", itemName: "BadPriceCandy");
            });
        }
コード例 #3
0
        public void GetItem_WhenMissingDepartmentName()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            Assert.ThrowsException <ArgumentNullException>(() =>
            {
                store.GetItem(deptName: null, itemName: "T-Shirt");
            });
        }
コード例 #4
0
        public void GetItem_WhenInvalidItemName()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            Assert.ThrowsException <NotFoundException>(() =>
            {
                store.GetItem(deptName: "Merchandise", itemName: "____");
            });
        }
コード例 #5
0
        public void GetItem_WhenInvalidDepartmentName()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            Assert.ThrowsException <NotFoundException>(() =>
            {
                store.GetItem(deptName: "___", itemName: "T-Shirt");
            });
        }
コード例 #6
0
        public void GetItem_WhenItemFound()
        {
            RetailStore store = RetailFactory.CreateGiftShop();

            RetailItem item = store.GetItem(deptName: "Merchandise", itemName: "T-Shirt");

            Assert.IsNotNull(item);

            Assert.AreEqual("T-Shirt", item.Name);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            RetailStore giftShop = RetailFactory.CreateGiftShop();

            RetailItem item = giftShop.GetItem("Merchandise", "T-Shirt");
        }
コード例 #8
0
 public RetailClient(RetailFactory retailFactory)
 {
     retailFactory1 = retailFactory;
 }