예제 #1
0
        public void VolunteerMethodTest()
        {
            VolunteerWorker thisWorker = new VolunteerWorker("Jane", "Doe", 40);
            double          totalPay   = thisWorker.CalculateWeeklyPay(thisWorker.HoursWorked);

            Assert.AreEqual(0, totalPay);
        }
예제 #2
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));
        }
예제 #3
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);
        }
예제 #4
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");
        }
        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");
        }
예제 #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);
        }
예제 #7
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);
        }