コード例 #1
0
        public ActionResult CoinResult()
        {
            CoinCombination inputtedNumber = new CoinCombination(Request.Form["enter-number"]);

            inputtedNumber.ReturnCoinTypes();
            List <double> myCoinCount = inputtedNumber.GetCoinCount();

            return(View("Index", myCoinCount));
        }
コード例 #2
0
        public void IsCoin_AllCoins_True()
        {
            CoinCombination newCombination = new CoinCombination();
            List <double>   testList       = new List <double>()
            {
                4, 1, 1, 3
            };

            CollectionAssert.AreEqual(testList, newCombination.CoinReturn(1.18));
        }
コード例 #3
0
        public void IsCoin_Penny_True()
        {
            CoinCombination newCombination = new CoinCombination();
            List <double>   testList       = new List <double>()
            {
                0, 0, 0, 4
            };

            CollectionAssert.AreEqual(testList, newCombination.CoinReturn(0.04));
        }
コード例 #4
0
        public void IsCoin_Dime_True()
        {
            CoinCombination newCombination = new CoinCombination();
            List <double>   testList       = new List <double>()
            {
                0, 2, 0, 0
            };

            CollectionAssert.AreEqual(testList, newCombination.CoinReturn(0.20));
        }
コード例 #5
0
        public void IsCoin_Quarter_True()
        {
            CoinCombination newCombination = new CoinCombination();
            List <double>   testList       = new List <double>()
            {
                4, 0, 0, 0
            };

            CollectionAssert.AreEqual(testList, newCombination.CoinReturn(1.00));
        }
コード例 #6
0
    public static void Main()
    {
        CoinCombination totalCoinAmount = new CoinCombination();

        Console.WriteLine("Enter an amound of cents: ");
        int centCount = int.Parse(Console.ReadLine());

        totalCoinAmount.TotalCoins(centCount);

        Console.WriteLine("Your change is: ");
        Console.WriteLine("Quarters: " + totalCoinAmount.GetQuarter());
        Console.WriteLine("Dimes: " + totalCoinAmount.GetDimes());
        Console.WriteLine("Nickels: " + totalCoinAmount.GetNickels());
        Console.WriteLine("Pennies: " + totalCoinAmount.GetPenny());
    }
コード例 #7
0
        public void InputCheck_InputIsNumber_True()
        {
            CoinCombination testCC = new CoinCombination("5");

            Assert.AreEqual(true, testCC.InputCheck("5"));
        }
コード例 #8
0
        public void ReturnCoinTypes_InputIsFiftyNineCents_True()
        {
            CoinCombination testAmount = new CoinCombination("59");

            Assert.AreEqual("2 quarters, 0 dimes, 1 nickels, 4 pennies", testAmount.ReturnCoinTypes());
        }
コード例 #9
0
        public void ReturnCoinTypes_InputIsTwentyFiveCents_True()
        {
            CoinCombination testAmount = new CoinCombination("25");

            Assert.AreEqual("1 quarters, 0 dimes, 0 nickels, 0 pennies", testAmount.ReturnCoinTypes());
        }
コード例 #10
0
        [TestMethod] //this will break soon. will need to update
        public void ReturnCoinTypes_InputIsEightCents_True()
        {
            CoinCombination testAmount = new CoinCombination("8");

            Assert.AreEqual("0 quarters, 0 dimes, 1 nickels, 3 pennies", testAmount.ReturnCoinTypes());
        }
コード例 #11
0
        public void ReturnCoinTypes_InputIsOneCent_True()
        {
            CoinCombination testAmount = new CoinCombination("1");

            Assert.AreEqual("0 quarters, 0 dimes, 0 nickels, 1 pennies", testAmount.ReturnCoinTypes());
        }