public void AddMoney_OutOfSpecifiedRangeTest() { //Arrange Catering moneyTest = new Catering(); //Act string result1 = moneyTest.AddMoney("7777"); string result2 = moneyTest.AddMoney("-42"); //Assert Assert.AreEqual(result1, "Balance must be between 0 and $5000"); Assert.AreEqual(result2, "Balance must be between 0 and $5000"); }
public void AddMoney_NotEnteringAnIntegerTest() { //Arrange Catering moneyTest = new Catering(); //Act string result = moneyTest.AddMoney("twenty five"); string result2 = moneyTest.AddMoney(""); //Assert Assert.AreEqual(result, "You must enter an integer"); Assert.AreEqual(result2, "You must enter an integer"); }
public void AddMoney_EdgeCaseTest() { //Arrange Catering moneyTest = new Catering(); //Act string result1 = moneyTest.AddMoney("0"); string result2 = moneyTest.AddMoney("5000"); //Assert Assert.AreEqual(result1, "Your account balance is: $0"); Assert.AreEqual(result2, "Your account balance is: $5000"); }
public void AddMoney_DoItTwice() { //Arrange Catering moneyTest = new Catering(); //Act string result = moneyTest.AddMoney("500"); result = moneyTest.AddMoney("750"); //Assert Assert.AreEqual(result, "Your account balance is: $1250"); }
public void AddMoney_does_it_add_cents() { Catering catering = new Catering(); string result = catering.AddMoney(100.50M); Assert.AreEqual("Sorry, you can only add whole dollar amounts", result); }
public void AddMoney_does_it_add() { Catering catering = new Catering(); string result = catering.AddMoney(100.00M); Assert.AreEqual("Added successfully", result); }
public void TestCateringMethods(int MoneyAdded, int ExpectedBalance) { Catering catering = new Catering(); catering.AddMoney((decimal)MoneyAdded); Assert.IsTrue((decimal)ExpectedBalance == (decimal)catering.customerMoney); }
public void AddMoney_does_it_allow_more_than_5k() { Catering catering = new Catering(); string result = catering.AddMoney(10000.00M); Assert.AreEqual("Sorry, your account balance can't exceed $5000", result); }
public void AddMoney_cant_pass_5K_w_balance() { Catering catering = new Catering(); catering.AccountBalance = 250.00M; string result = catering.AddMoney(5000.00M); Assert.AreEqual("Sorry, your account balance can't exceed $5000", result); }
public void AddMoney_does_it_add_to_existing_balance() { Catering catering = new Catering(); catering.AccountBalance = 100.00m; string result = catering.AddMoney(100.00M); Assert.AreEqual("Added successfully", result); }
public void TestSpendMoney(int costOfPurchase, int expectedBalance) { Catering catering = new Catering(); decimal moneyToAdd = 4000m; bool moneyAdded = catering.AddMoney(moneyToAdd); decimal result = catering.SpendMoney((decimal)costOfPurchase); Assert.AreEqual((decimal)expectedBalance, result); }
public void TestAddMoney() { //arrange Catering catering = new Catering(fa); //act catering.AddMoney("20"); //assert Assert.AreEqual(20.00M, catering.Balance); }
public void PurchaseIndividualItem_ItemAddedToCartTest() { //Arrange Catering purchaseTest = new Catering(); purchaseTest.AddMoney("500"); //Act string result = purchaseTest.PurchaseIndividualItem("B3", 10); //Assert Assert.AreEqual(result, "ITEM ADDED TO CART"); }
public void PurchaseIndividualItem_InsuffucientFundsTest() { //Arrange Catering purchaseTest = new Catering(); //Act purchaseTest.AddMoney("500"); string result = purchaseTest.PurchaseIndividualItem("E3", 49); //Assert Assert.AreEqual(result, "INSUFFICIENT FUNDS"); }
public void PurchaseIndividualItem_InsuffucientStockTest() { //Arrange Catering purchaseTest = new Catering(); //Act purchaseTest.AddMoney("1000"); string result = purchaseTest.PurchaseIndividualItem("B3", 35); result = purchaseTest.PurchaseIndividualItem("B3", 25); //Assert Assert.AreEqual(result, "INSUFFICIENT STOCK"); }
public void AddMoneyTestOverFiveThousand() { // Arrange Catering catering = new Catering(); decimal amount = 6000.00M; string expected = "Balance cannot exceed $5000"; // Act string result = catering.AddMoney(amount); // Assert Assert.AreEqual(expected, result); }
public void PurchaseIndividualItem_SoldOutTest() { //Arrange Catering purchaseTest = new Catering(); //Act purchaseTest.AddMoney("1000"); string result = purchaseTest.PurchaseIndividualItem("B3", 50); result = purchaseTest.PurchaseIndividualItem("B3", 1); //Assert Assert.AreEqual(result, "SOLD OUT"); }
public void TestIsSufficientQuanity() { //arrange Catering catering = new Catering(fa); CateringItem[] items = catering.GetInventory(); string code = items[0].ProductCode; //first item // act catering.AddMoney("2000"); //assert Assert.IsTrue(catering.IsSufficientQuanity(code, "50")); }
public void AddMoneyTestNegativeInput() { // Arrange Catering catering = new Catering(); decimal amount = -100.0M; string expected = "Can not add negative balance amount, please enter a positive amount"; // Act string result = catering.AddMoney(amount); // Assert Assert.AreEqual(expected, result); }
public void AddMoneyTest() { // Arrange Catering catering = new Catering(); decimal amount = 100.0M; string expected = "Your balance is: " + amount.ToString("C"); // Act string result = catering.AddMoney(amount); // Assert Assert.AreEqual(expected, result); }
public void TestMakeChange() { //arrange Catering catering = new Catering(fa); //act catering.AddMoney("20"); //Assert Assert.AreEqual("1 - Twenty", catering.MakeChange()); //act catering.AddMoney("40"); //Assert Assert.AreEqual("2 - Twenty", catering.MakeChange()); //act catering.AddMoney("50"); //Assert Assert.AreEqual("2 - Twenty, 1 - Ten", catering.MakeChange()); }
public void UpdateBalanceTest() { //Arrange Catering balanceTest = new Catering(); CateringItem testItem = new CateringItem(); balanceTest.AddMoney("500"); testItem.Price = (decimal)1.50; //Act balanceTest.UpdateBalance(testItem, 20); //Assert Assert.AreEqual(balanceTest.Balance, 470); }
public void TestIsSoldOut() { //arrange Catering catering = new Catering(fa); CateringItem[] items = catering.GetInventory(); string code = items[0].ProductCode; //first item catering.AddMoney("2000"); //act catering.MakePurchase(code, "50"); //assert Assert.IsTrue(catering.IsSoldOut(code)); }
public void TestGetPurchases() { //arrange Catering catering = new Catering(fa); CateringItem[] items = catering.GetInventory(); string code = items[0].ProductCode; //first item catering.AddMoney("20"); catering.MakePurchase(code, "1"); //act CateringItem[] purchases = catering.GetPurchases(); //assert Assert.AreEqual(1, purchases.Length); }
public void TestsSufficientFunds() { //arrange Catering catering = new Catering(fa); CateringItem[] items = catering.GetInventory(); string code = items[0].ProductCode; //first item decimal price = items[0].Price; //act //how much for 5 of them? decimal extendedPrice = price * 5; //add that amount + 1 dollar int moneyToAdd = (int)Math.Ceiling(extendedPrice) + 1; catering.AddMoney(moneyToAdd.ToString()); Assert.IsTrue(catering.IsSufficientFunds(code, "5")); Assert.IsFalse(catering.IsSufficientFunds(code, "10")); }