示例#1
0
        public void InitializeScanningSystem()
        {
            _cashRegisterDisplay = new CashRegisterDisplay();
            IEditableCatalog catalog = new Catalog();
            catalog.AddPriceWithoutPst("12345", 500.00);
            catalog.AddPriceWithPst("23456", 750.00);

            _salesPoint = new SalesPoint(catalog, _cashRegisterDisplay);
        }
示例#2
0
        public void NoGoodFoundReturnsError()
        {
            const string testBarcode = "12345";

            _mockScreenBuilder.ExpectNoCall("DisplayProductInfo");
            _mockScreenBuilder.Expect("DisplayProductNotFound", testBarcode);

            var mockScreen = (ICashRegisterDisplay)_mockScreenBuilder.MockInstance;

            _mockCatalogBuilder.ExpectNoCall("get_Item");
            _mockCatalogBuilder.ExpectAndReturn("HasBarcode", false, testBarcode);

            var mockCatalog = (ICatalog)_mockCatalogBuilder.MockInstance;

            var salesPoint = new SalesPoint(mockCatalog, mockScreen);

            salesPoint.OnBarcode(testBarcode);
        }
示例#3
0
        public void FoundProductShouldOutputPrice()
        {
            var testPrice = new ProductPriceInfo
                                           {
                                               NetPrice = 500.0,
                                               PstIncluded = false,
                                           };

            const string testBarcode = "12345";

            _mockScreenBuilder.Expect("DisplayProductInfo", testPrice);

            var mockScreen = (ICashRegisterDisplay)_mockScreenBuilder.MockInstance;

            _mockCatalogBuilder.ExpectAndReturn("get_Item", testPrice, testBarcode);
            _mockCatalogBuilder.ExpectAndReturn("HasBarcode", true, testBarcode);

            var mockCatalog = (ICatalog)_mockCatalogBuilder.MockInstance;

            var salesPoint = new SalesPoint(mockCatalog, mockScreen);

            salesPoint.OnBarcode(testBarcode);
        }