public void CoinCombination_CalculateAllCoins_List() { CoinCombinationGenerator testCoinCombination = new CoinCombinationGenerator(); List <int> coinsList = new List <int>() { 2, 1, 1, 3 }; CollectionAssert.AreEqual(coinsList, testCoinCombination.CalculateAllCoins(68)); }
public ActionResult Display() { CoinCombinationGenerator newCoinCombination = new CoinCombinationGenerator(); int cents = Int32.Parse(Request.Form["cents"]); // int quarters = newCoinCombination.CalculateQuarters(cents); // int dimes = newCoinCombination.CalculateDimes(cents - (quarters * 25)); // int nickels = newCoinCombination.CalculateNickels(cents - (quarters * 25) - (dimes * 10)); // int pennies = newCoinCombination.CalculatePennies(cents - (quarters * 25) - (dimes * 10) - (nickels * 5)); List <int> coinsList = newCoinCombination.CalculateAllCoins(cents); newCoinCombination.SetQuarters(coinsList[0]); newCoinCombination.SetDimes(coinsList[1]); newCoinCombination.SetNickels(coinsList[2]); newCoinCombination.SetPennies(coinsList[3]); newCoinCombination.SetTotalCents(cents); return(View(newCoinCombination)); }
public void CoinCombination_CalculateNickels_Int() { CoinCombinationGenerator testCoinCombination = new CoinCombinationGenerator(); Assert.AreEqual(1, testCoinCombination.CalculateNickels(8)); }
public void CoinCombination_CalculatePennies_Int() { CoinCombinationGenerator testCoinCombination = new CoinCombinationGenerator(); Assert.AreEqual(3, testCoinCombination.CalculatePennies(3)); }
public void CoinCombination_CalculateQuarters_Int() { CoinCombinationGenerator testCoinCombination = new CoinCombinationGenerator(); Assert.AreEqual(2, testCoinCombination.CalculateQuarters(68)); }