Beispiel #1
0
        public void CreateChangeCalculator_CalculateChangePriceAmountSubmitted_DisplayChangeOwed()
        {
            // Arrange
            int testPrice = 10;
            int testTendered = 30;
            ChangeCalculator newChangeCalculator = new ChangeCalculator(testPrice, testTendered);
            int resultPrice = newChangeCalculator.GetPrice();
            int resultTendered = newChangeCalculator.GetTendered();

            // Act
            int myResult = newChangeCalculator.ChangePrice(resultPrice, resultTendered);

            // Assert
            Assert.Equal(20, myResult);
        }
Beispiel #2
0
        public void CalculateCoins_FewestCoinsReturned_true()
        {
            // Arrange
            int testPrice = 200;
            int testTendered = 299;
            ChangeCalculator newChangeCalculator = new ChangeCalculator(testPrice, testTendered);
            int testChange = newChangeCalculator.ChangePrice(testPrice, testTendered);
            int testQuarters = 4;
            int testPennies = 0;

            // Act
            string resultPennies = newChangeCalculator.CalculateCoins(testChange);

            // Assert
            Console.WriteLine(resultPennies);
            Assert.Equal(testPennies, resultPennies);
        }