public void SetUp() { _mocks = new MockRepository(); _mockDisplay = _mocks.StrictMock<IDisplay>(); _mPoducts = new List<Product>() {new Product("xyz", 12, false), new Product("abc", 123, false), new Product("alma", 23, true), new Product("apple", 34, false), new Product("orange", 36, false), new Product("kiwi", 19, true), new Product("grapes", 98, true) }; _mBarcodeScannerDataProcessor = new BarcodeScannerDataProcessor(_mPoducts, _mockDisplay); _mTaxManager = new TaxManager(_mFederalTaxRate, _mProvincialTaxRate); _mDisplay = new Display(_mTaxManager); }
public void TestAddMultipleProductsToShoppingCartAndPrintBill() { var lPrinter = new ConsolePrinter(); var lBs = new BarcodeScannerDataProcessor(_mPoducts, _mDisplay, lPrinter); lBs.Scan("apple"); lBs.Scan("orange"); lBs.Scan("kiwi"); lBs.Scan("grapes"); string lsBill = lPrinter.PrintBill(_mDisplay.ShoppingCart); Assert.AreEqual("$34GP\r\n$36GP\r\n$19G\r\n$98G\r\nSubtotal: 187\r\nGST: 9.35\r\nPST: 5.60\r\n------\r\nTOTAL: 201.95\r\n", lsBill); }
public void TestProductPriceWithFederalTaxOnlyWithManualIDisplayMock() { var displayMock = new ManualDisplayMock(); var lBs = new BarcodeScannerDataProcessor(_mPoducts, displayMock); lBs.Scan("xyz"); Assert.AreEqual(Convert.ToDecimal(13.56), displayMock.Price); }