示例#1
0
        public void CalculateWeeklyPay_AlwaysExpectZero()
        {
            VolunteerWorker vw = new VolunteerWorker("John", "Doe");

            Assert.AreEqual(0, vw.CalculateWeeklyPay(0));
            Assert.AreEqual(0, vw.CalculateWeeklyPay(20));
            Assert.AreEqual(0, vw.CalculateWeeklyPay(40));
        }
示例#2
0
        public void CalculateWeeklyPay()
        {
            VolunteerWorker newtest = new VolunteerWorker("test", "test");

            Assert.AreEqual(0, newtest.CalculateWeeklyPay(0), "input : 0");
            Assert.AreEqual(0, newtest.CalculateWeeklyPay(50), "input : 50");
            Assert.AreEqual(0, newtest.CalculateWeeklyPay(-30), "input : -30");
            Assert.AreEqual(0, newtest.CalculateWeeklyPay(3000), "input : 3000");
        }
示例#3
0
        public void CalculateWeeklyPayTest()
        {
            double expected = 0;
            double actual   = volunteerWorker.CalculateWeeklyPay(40);

            Assert.AreEqual(expected, actual, "Hourly rate of 50 and worked 40 hours");


            expected = 0;
            actual   = volunteerWorker.CalculateWeeklyPay(50);
            Assert.AreEqual(expected, actual, "Hourly rate of 50 and worked 50 hours");
        }
示例#4
0
        public void VolunteerMethodTest()
        {
            VolunteerWorker thisWorker = new VolunteerWorker("Jane", "Doe", 40);
            double          totalPay   = thisWorker.CalculateWeeklyPay(thisWorker.HoursWorked);

            Assert.AreEqual(0, totalPay);
        }
示例#5
0
        public void VolunteerWorkerAllTests()
        {
            VolunteerWorker salaryTest = new VolunteerWorker("Jacob", "Rutter");

            Assert.AreEqual(0, salaryTest.CalculateWeeklyPay(10));
            Assert.AreEqual("Jacob", salaryTest.FirstName);
            Assert.AreEqual("Rutter", salaryTest.LastName);
        }
示例#6
0
        public void VolunteerWorkerGetsDidley()
        {
            // Arrange
            Worker worker = new VolunteerWorker();

            // Act
            decimal pay = worker.CalculateWeeklyPay(40);

            // Assert
            Assert.AreEqual(0m, pay);

            // Try with different hours worked
            pay = worker.CalculateWeeklyPay(0);
            Assert.AreEqual(0m, pay);

            // Try with different hours worked
            pay = worker.CalculateWeeklyPay(100);
            Assert.AreEqual(0m, pay);
        }
        public void CalculateWeeklyPay_Tests()
        {
            int             hoursWorked = 10;
            double          Result;
            VolunteerWorker volunteerWorker = new VolunteerWorker("Warren", "stowe");

            Result = volunteerWorker.CalculateWeeklyPay(hoursWorked);
            //assert is not null
            Assert.IsNotNull(Result, "should not be null");
            Assert.AreEqual(Result, 0, "result should be 0");
        }
示例#8
0
        public void VolunteerWorkerTest()
        {
            VolunteerWorker myVolunteerWorker = new VolunteerWorker("Johnny", "Doe");

            Assert.AreEqual("Johnny", myVolunteerWorker.FirstName);
            Assert.AreEqual("Doe", myVolunteerWorker.LastName);

            Assert.AreEqual(0, myVolunteerWorker.CalculateWeeklyPay(40));
            Assert.AreEqual(40, myVolunteerWorker.HoursWorked);

            myVolunteerWorker = new VolunteerWorker("", "");
            Assert.AreEqual("unknown", myVolunteerWorker.FirstName);
            Assert.AreEqual("unknown", myVolunteerWorker.LastName);
            Assert.AreEqual(0, myVolunteerWorker.CalculateWeeklyPay(-40));
            Assert.AreEqual(0, myVolunteerWorker.HoursWorked);

            myVolunteerWorker = new VolunteerWorker(null, null);
            Assert.AreEqual("unknown", myVolunteerWorker.FirstName);
            Assert.AreEqual("unknown", myVolunteerWorker.LastName);
        }
示例#9
0
 public void VolunteerCalculateWeeklyPay()
 {
     Assert.AreEqual(0, _volunteerWorker.CalculateWeeklyPay(500), "passed weeklyHours 500");
     Assert.AreEqual(0, _volunteerWorker.CalculateWeeklyPay(-500), "passed weeklyHours -500");
     Assert.AreEqual(0, _volunteerWorker.CalculateWeeklyPay(0), "passed weeklyHours 0");
 }