static void Main(string[] args)
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            decimal            wages    = computer.ComputeWages(0, 10);

            if (wages == 0)
            {
                Console.WriteLine("PASSED: 0 hours, 10 rate returned 0");
            }
            else
            {
                Console.WriteLine("Check failed. Wages was: " + wages);
            }

            wages = computer.ComputeWages(1, 10);

            if (wages == 10)
            {
                Console.WriteLine("Passed: 1 hour, 10 rate returned 10");
            }
            else
            {
                Console.WriteLine("Check failed. Wages was: " + wages);
            }
        }
Beispiel #2
0
        public void WhenHoursAreNegative_ThenRaiseNegativeHoursError()
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            decimal            wages    = computer.ComputeWages(-1, 10);

            Assert.AreEqual(HourlyWageComputer.ERR_NEGATIVE_HOURS, wages);
        }
Beispiel #3
0
        public void ThenOneHourAtTenRate_ReturnsTen()
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            decimal            wages    = computer.ComputeWages(1, 10);

            Assert.AreEqual(10, wages);
        }
Beispiel #4
0
        public void WhenRateIsNegative_ThenRaseNegativeRateError()
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            decimal            wages    = computer.ComputeWages(1, -1);

            Assert.AreEqual(HourlyWageComputer.ERR_NEGATIVE_RATE, wages);
        }
Beispiel #5
0
        public void Then40HoursAtTenRate_Returns400()
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            decimal            wages    = computer.ComputeWages(40, 10);

            Assert.AreEqual(400, wages);
        }
        public void ThenHoursWorkedOf81_RaisesException()
        {
            HourlyWageComputer computer = new HourlyWageComputer();

            Assert.Throws <System.ArgumentException>(
                () =>
                computer.ComputeWages(81, 10));
        }
Beispiel #7
0
        public void ThenZeroHoursAtTenRate_ReturnsZero()
        {
            HourlyWageComputer computer = new HourlyWageComputer();
            int     hoursWorked         = 0;
            int     hourlyRate          = 10;
            decimal wages = computer.ComputeWages(hoursWorked, hourlyRate);

            Assert.AreEqual(0, wages);
        }
Beispiel #8
0
        public void CheckAllStraightTimeBoundaryValues(int hoursWorked,
                                                       int hourlyRate,
                                                       decimal expectWages)
        {
            HourlyWageComputer calculator  = new HourlyWageComputer();
            decimal            actualWages = calculator.ComputeWages(hoursWorked, hourlyRate);

            Assert.AreEqual(expectWages, actualWages, "TestCase Data: Hours Worked:" + hoursWorked +
                            " Hourly Rate: " + hourlyRate +
                            " Expected: " + expectWages);
        }
        public void ThenHourlyRateOf501_RaisesException()
        {
            HourlyWageComputer computer = new HourlyWageComputer();

            try
            {
                decimal wages =
                    computer.ComputeWages(1, HourlyWageComputer.MAX_HOURLY_RATE + 1);
            }
            catch (System.ArgumentException)
            {
                Assert.Pass("Argument exception caught");
            }
            Assert.Fail("Exception not caught");
        }