コード例 #1
0
        public void StartShiftUpdatesNoOfShiftsANDJobToNull_Correctly() //Checks that StartShift() from Employer class is being updated correctly & Current_Job is null when Shifts = 0;
        {
            UpdateJobDetailsCorrectly();                                //Sets Current_Job to Null & Shifts to 0.
            string Name        = "John Knight";
            int    Shifts      = 3;
            String jobSelected = ls[new Random().Next(0, 5)];

            one.AssignJob(jobSelected, Shifts, Name);
            SelectCurrent_JobAndShiftsQuery(Name);//Selects Shifts & Current_Job from dummy database - as defined above in Name, Shifts & jobSelected
            Assert.AreEqual(jobSelected, current_job);
            Assert.AreEqual(Shifts, shifts);

            one.StartShift();//Check values before and afterthis method called.
            SelectCurrent_JobAndShiftsQuery(Name);
            Assert.AreEqual(2, shifts);

            one.StartShift();//Check value of shifts is now 2-1.
            SelectCurrent_JobAndShiftsQuery(Name);
            Assert.AreEqual(1, shifts);
            Assert.AreEqual(jobSelected, current_job);

            one.StartShift();//Check value of shifts is now 1-0 & Current_Job is an Empty string/null.
            SelectCurrent_JobAndShiftsQuery(Name);
            Assert.AreEqual(0, shifts);
            Assert.AreEqual("", current_job);
        }
コード例 #2
0
 private void startShiftButton_Click(object sender, EventArgs e)
 {
     employer.StartShift();
     jobsAssignedTextBox.Text += "\r\nSHIFT STARTED! ";
     startShiftButton.Enabled  = false;
 }