public void InventoryCalculateInventoryValueEqualsExpectedResults() { var inventory = new Models.Inventory(); //Add 4 products to inventory for (int i = 0; i < 4; i++) inventory.Add(new Product { Id = i, Quantity = 5, Price=10*i }); //Compare each product's inventory value to expected result for (int i = 0; i < 4; i++) { Assert.AreEqual(5 * 10 * i, inventory.ProductValue(i)); } }
public void InventoryCalculateInventoryValueEqualsExpectedResults() { var inventory = new Models.Inventory(); //Add 4 products to inventory for (int i = 0; i < 4; i++) { inventory.Add(new Product { Id = i, Quantity = 5, Price = 10 * i }); } //Compare each product's inventory value to expected result for (int i = 0; i < 4; i++) { Assert.AreEqual(5 * 10 * i, inventory.ProductValue(i)); } }
public void InventoryAddSubtractQuantityEqualsExpectedResults() { var inventory = new Models.Inventory(); //Add 4 products to inventory for (int i = 0; i < 4; i++) inventory.Add(new Product { Id = i, Quantity = 5 }); //Add to each product's quantity for (int i = 0; i < 4; i++) inventory.AddQuantity(i, i); //Compare added quantity with expected result for (int i = 0; i < 4; i++) Assert.AreEqual(5 + i, inventory.Product(i).Quantity); //Subtract to each product's quantity for (int i = 0; i < 4; i++) inventory.AddQuantity(i, -i); //Compare subtracted quantity with expected result for (int i = 0; i < 4; i++) Assert.AreEqual(5, inventory.Product(i).Quantity); }
public void InventoryAddSubtractQuantityEqualsExpectedResults() { var inventory = new Models.Inventory(); //Add 4 products to inventory for (int i = 0; i < 4; i++) { inventory.Add(new Product { Id = i, Quantity = 5 }); } //Add to each product's quantity for (int i = 0; i < 4; i++) { inventory.AddQuantity(i, i); } //Compare added quantity with expected result for (int i = 0; i < 4; i++) { Assert.AreEqual(5 + i, inventory.Product(i).Quantity); } //Subtract to each product's quantity for (int i = 0; i < 4; i++) { inventory.AddQuantity(i, -i); } //Compare subtracted quantity with expected result for (int i = 0; i < 4; i++) { Assert.AreEqual(5, inventory.Product(i).Quantity); } }