コード例 #1
0
        public void CalcChange_TestOneForAll()
        {
            CoinFinder coinTest = new CoinFinder(41);

            coinTest.CalcChange();
            Dictionary <string, int> testDict = new Dictionary <string, int> {
                { "Quarter", 1 }, { "Dime", 1 }, { "Nickel", 1 }, { "Penny", 1 }
            };

            CollectionAssert.AreEqual(testDict, coinTest.GetChangeAmt());
        }
コード例 #2
0
 public static void PrintChange(int totalCents, CoinFinder myObj)
 {
     Console.WriteLine("Your change for " + totalCents + ":");
     foreach (KeyValuePair <string, int> kvp in myObj.GetChangeAmt())
     {
         if (kvp.Value == 0)
         {
             continue;
         }
         Console.WriteLine("{0} : {1}.", kvp.Key, kvp.Value);
     }
 }