public void TestWhenValueIsEqualTo5()
        {
            //Arrange
            CoinChanger program = new CoinChanger();

            //Act
            program.GetTheChange(5);
            program.incrementdime = 5;
            //Assert
            Assert.AreEqual(program.incrementdime, 5);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            for (int i = 1; i < 99; i++)

            {
                coins = new CoinChanger();
                coins.GetTheChange(i);
                Console.WriteLine("Quarter: " + coins.incrementquarter + " Dimes: " + coins.incrementdime + " Nickels: " + coins.incrementnickel + " Pennies: " + coins.incrementpenny);
            }
            Console.ReadLine();
        }
        public void TestWhenValueIsLessThan10()
        {
            //Arrange
            CoinChanger program = new CoinChanger();

            //Act
            program.GetTheChange(5);
            program.incrementdime = 0;
            //Assert
            Assert.AreEqual(program.incrementdime, 0);
        }
        public void TestWhenValueIsGreaterThan10()
        {
            //Arrange
            CoinChanger program = new CoinChanger();

            //Act
            program.GetTheChange(15);
            program.incrementdime = 10;
            //Assert
            Assert.AreEqual(program.incrementdime, 10);
        }
        public void TestWhenValueIsLessThan25()
        {
            //Arrange
            CoinChanger program = new CoinChanger();

            //Act
            program.GetTheChange(20);
            program.incrementquarter = 0;
            //Assert
            Assert.AreEqual(program.incrementquarter, 0);
        }
        public void TestWhenValueMoreThan25()
        {
            //Arrange
            CoinChanger program = new CoinChanger();

            //Act
            program.GetTheChange(46);
            program.incrementquarter = 25;
            //Assert
            Assert.AreEqual(program.incrementquarter, 25);
        }
Esempio n. 7
0
        public void WhenOneDime()
        {
            //Arrange
            CoinChanger singlecoin = new CoinChanger();

            //Act
            singlecoin.GetTheChange(10);
            int numberOfDimes = singlecoin.incrementdime;

            //Assert
            Assert.AreEqual(numberOfDimes, 1);
        }
Esempio n. 8
0
        public void When20Cents()
        {
            //Arrange
            CoinChanger test1 = new CoinChanger();

            //Act
            test1.GetTheChange(20);
            int numberOfDimes = test1.incrementdime;

            //Assert
            Assert.AreEqual(2, numberOfDimes);
        }
Esempio n. 9
0
        public void WhenOneQuarter()
        {
            //Arrange
            CoinChanger singlecoin = new CoinChanger();

            //Act
            singlecoin.GetTheChange(25);
            int numberOfQuarters = singlecoin.incrementquarter;

            //Assert
            Assert.AreEqual(numberOfQuarters, 1);
        }
Esempio n. 10
0
        public void WhenOneNickel()
        {
            //Arrange
            CoinChanger singlecoin = new CoinChanger();

            //Act
            singlecoin.GetTheChange(5);
            int numberOfNickels = singlecoin.incrementnickel;

            //Assert
            Assert.AreEqual(numberOfNickels, 1);
        }
Esempio n. 11
0
        public void WhenOnePenny()
        {
            //Arrange
            CoinChanger singlecoin = new CoinChanger();

            //Act
            singlecoin.GetTheChange(1);
            int numberofpennies = singlecoin.incrementpenny;

            //Assert
            Assert.AreEqual(numberofpennies, 1);
        }
Esempio n. 12
0
        public void When2Cents()
        {
            //Arrange
            CoinChanger test1 = new CoinChanger();

            //Act
            test1.GetTheChange(2);
            int numberOfPennies = test1.incrementpenny;

            //Assert
            Assert.AreEqual(2, numberOfPennies);
        }
Esempio n. 13
0
        //TestRule#1=> Multiple Coins
        //When 50 = 2Quarters
        //When 20 = 2Dimes
        //Wnen 10 = 2Nickels
        //When 2= 2Pennies
        public void When50Cents()
        {
            //Arrange
            CoinChanger test1 = new CoinChanger();

            //Act (Expected)
            test1.GetTheChange(50);
            int numberOfQuarters = test1.incrementquarter;

            //Assert
            Assert.AreEqual(2, numberOfQuarters);
        }
Esempio n. 14
0
        public void When10Cents()
        {
            //Arrange
            CoinChanger test1 = new CoinChanger();

            //Act
            test1.GetTheChange(10);
            int numberOfnickels     = test1.incrementnickel;
            int numberOfDimesWhen10 = test1.incrementdime;

            //Assert
            Assert.AreEqual(0, numberOfnickels);
            Assert.AreEqual(1, numberOfDimesWhen10);
        }
Esempio n. 15
0
        public void MixIdeasTest1()
        {
            //Arrange
            CoinChanger test = new CoinChanger();

            //Act
            test.GetTheChange(99);
            int numberOfQuarters = test.incrementquarter;
            int numberOfDimes    = test.incrementdime;
            int numberOfNickels  = test.incrementnickel;
            int numberOfPennies  = test.incrementpenny;

            //Assert
            Assert.AreEqual(3, numberOfQuarters);
            Assert.AreEqual(2, numberOfDimes);
            Assert.AreEqual(0, numberOfNickels);
            Assert.AreEqual(4, numberOfPennies);
        }
Esempio n. 16
0
        public void MixIdeasTest2()
        {
            //Arrange
            CoinChanger test2 = new CoinChanger();

            //Act
            test2.GetTheChange(68);
            int numberOfQuarters = test2.incrementquarter;
            int numberOfDimes    = test2.incrementdime;
            int numberOfNickels  = test2.incrementnickel;
            int numberOfPennies  = test2.incrementpenny;

            //Assert
            Assert.AreEqual(numberOfQuarters, 2);
            Assert.AreEqual(numberOfDimes, 1);
            Assert.AreEqual(numberOfNickels, 1);
            Assert.AreEqual(numberOfPennies, 3);
        }
Esempio n. 17
0
        public void DifferentCoinsTest2()
        {
            //Arrange
            CoinChanger differentCoins = new CoinChanger();

            //Act
            differentCoins.GetTheChange(36);
            int numberOfQuarters = differentCoins.incrementquarter;
            int numberOfDimes    = differentCoins.incrementdime;
            int numberOfNickels  = differentCoins.incrementnickel;
            int numberOfPennies  = differentCoins.incrementpenny;

            //Assert
            Assert.AreEqual(numberOfQuarters, 1);
            Assert.AreEqual(numberOfDimes, 1);
            Assert.AreEqual(numberOfNickels, 0);
            Assert.AreEqual(numberOfPennies, 1);
        }