public void AddItemsQuantityAndPriceAdded() { // Arrange string pName = "Beans"; decimal lPrice = 1.00M; int quant = 4; OrderItem beans = new OrderItem(pName, lPrice, quant); // Act beans.AddItems(1.00M, 2); // Assert Assert.AreEqual("Beans", beans.ProductName); Assert.AreEqual(1.00M, beans.LatestPrice); Assert.AreEqual(6, beans.Quantity); beans.AddItems(1.00M, 2); Assert.AreEqual(8, beans.Quantity); }
public void AddItemQuantityAddedInvalid() { // Arrange string pName = "Beans"; decimal lPrice = 1.00M; int quant = 4; OrderItem beans = new OrderItem(pName, lPrice, quant); // Act beans.AddItems(1.00M, -1); // Assert }
public void AddItemsTestQtyOnly() { string prodname = "Banana"; decimal latestPrice = 0.75m; int quantity = 3; OrderItem target = new OrderItem(prodname, latestPrice, quantity); int qty = 2; int actual = target.AddItems(qty); int expected = 5; Assert.AreEqual(expected, actual); }
public void AddTwoItemsTest() { // Assemble string name = "Orange"; decimal price = 0.50m; int quantity = 5, addingQuantity = 2; bool expected = true, actual = false; OrderItem Actual = new OrderItem(name, price, quantity); // Act Actual.AddItems(addingQuantity); if (Actual.Quantity == quantity + addingQuantity) { actual = true; } // Assert Assert.AreEqual(expected, actual); }
public void TotalOrderTest() { // Assemble string name = "Orange"; decimal price = 0.50m; int quantity = 5; bool expected = true, actual = false; OrderItem Actual = new OrderItem(name, price, quantity); // Act Actual.AddItems(); if (Actual.TotalOrder == 3.00m) { actual = true; } // Assert Assert.AreEqual(expected, actual); }