@Test public void testAddToPrice() throws Exception { double dEndPrice = 2.1186; // price*amountBuy*myCart.TAX_FOOD; int iAmountBuy = 2; CRS.addToPrice(myCart, sBarcode.toCharArray(), iAmountBuy); assertEquals(dEndPrice, myCart.getdFullPrice(), 0.001); }
@Test public void testRemoveFromPrice() throws Exception { double dEndPrice = 1.0593; // price * (amountBuy - amountRemove) * myCart.TAX_FOOD; int iAmountBuy = 2; int iAmountRemove = 1; CRS.addToPrice(myCart, sBarcode.toCharArray(), iAmountBuy); CRS.removeFromPrice(myCart, sBarcode.toCharArray(), iAmountRemove); assertEquals(dEndPrice, myCart.getdFullPrice(), 0.001); }