コード例 #1
0
        public void TestHandlesUnknownProductsGracefully()
        {
            MockProduct              mockProduct              = new MockProduct();
            ProductStock             productStock             = new ProductStock();
            MockProductStockObserver mockProductStockObserver = new MockProductStockObserver();

            productStock.RegisterObserver(mockProductStockObserver);

            productStock.Remove(mockProduct);
            Assert.AreEqual(0, productStock.Count(mockProduct));
            Assert.AreEqual(0, mockProductStockObserver.NumberOfTimesProductStockUpdatedWasCalled);
        }
コード例 #2
0
        public void TestHandlesUnknownProductsGracefully()
        {
            MockProduct mockProduct = new MockProduct();
            ProductStock productStock = new ProductStock();
            MockProductStockObserver mockProductStockObserver = new MockProductStockObserver();

            productStock.RegisterObserver(mockProductStockObserver);
            
            productStock.Remove(mockProduct);
            Assert.AreEqual(0, productStock.Count(mockProduct));
            Assert.AreEqual(0, mockProductStockObserver.NumberOfTimesProductStockUpdatedWasCalled);
        }