Esempio n. 1
0
        private static void RunOneTimeTest(MainForm frm)
        {
            PFSchedule             sked         = new PFSchedule(frm.txtScheduleName.Text.Trim());
            bool                   isScheduled  = false;
            enScheduleLookupResult lookupResult = enScheduleLookupResult.Unknown;

            CreateRunOneTimeSchedule(frm, sked);

            isScheduled  = sked.DateIsScheduled(sked.TestCurrDateTime);
            lookupResult = sked.ScheduleLookupResult;


            _msg.Length = 0;
            _msg.Append("Schedule type:        ");
            _msg.Append(sked.ScheduleFrequency.ToString());
            _msg.Append("\r\n");
            _msg.Append("Schedule Name:        ");
            _msg.Append(sked.Name);
            _msg.Append("\r\n");
            _msg.Append("RunAt date:           ");
            _msg.Append(sked.RunAt.ToString("MM/dd/yyyy HH:mm:ss"));
            _msg.Append("\r\n");
            _msg.Append("Test date:            ");
            _msg.Append(sked.TestCurrDateTime.ToString("MM/dd/yyyy HH:mm:ss"));
            _msg.Append("\r\n");
            _msg.Append("Actual result:        ");
            _msg.Append(lookupResult.ToString());
            _msg.Append("\r\n");
            _msg.Append("Expected test result: ");
            _msg.Append(sked.ExpectedTestResult.ToString());
            _msg.Append("\r\n");
            _msg.Append("Success/Failure:      ");
            if (sked.ExpectedTestResult == lookupResult)
            {
                _msg.Append("SUCCESS");
            }
            else
            {
                _msg.Append("FAIL");
            }
            _msg.Append("\r\n");
            Program._messageLog.WriteLine(_msg.ToString());
        }
Esempio n. 2
0
        private static void RunMonthlyTest(MainForm frm)
        {
            PFSchedule             sked         = new PFSchedule(frm.txtScheduleName.Text.Trim());
            bool                   isScheduled  = false;
            enScheduleLookupResult lookupResult = enScheduleLookupResult.Unknown;

            CreateMonthlySchedule(frm, sked);

            isScheduled  = sked.DateIsScheduled(sked.TestCurrDateTime);
            lookupResult = sked.ScheduleLookupResult;

            _msg.Length = 0;
            _msg.Append("Schedule type:        ");
            _msg.Append(sked.ScheduleFrequency.ToString());
            _msg.Append("\r\n");
            _msg.Append("Schedule Name:        ");
            _msg.Append(sked.Name);
            _msg.Append("\r\n");
            _msg.Append("Schedule Start Date:  ");
            _msg.Append(sked.ScheduleStartDate.ToString("MM/dd/yyyy HH:mm:ss"));
            _msg.Append("\r\n");
            _msg.Append("Schedule End Date:    ");
            _msg.Append(sked.ScheduleEndDate.ToString("MM/dd/yyyy HH:mm:ss"));
            _msg.Append("\r\n");


            if (sked.MonthlyScheduleMonthIdType == enMonthlyScheduleMonthIdType.EveryNumMonths)
            {
                _msg.Append("Schedule runs every:  ");
                _msg.Append(sked.MonthlyOccursEveryNumMonths.ToString());
                _msg.Append(" month(s)");
            }
            else
            {
                _msg.Append("Scheduled months:     ");
                _msg.Append(GetScheduledMonthDaysList(sked));
                _msg.Append("\r\n");
            }
            _msg.Append("\r\n");

            if (sked.MonthlyScheduleDayIdType == enMonthlyScheduleDayIdType.DayNumber)
            {
                _msg.Append("Schedule runs on day: ");
                _msg.Append(sked.MonthlyScheduleDay.ToString());
            }
            else
            {
                _msg.Append("Schedule runs on:     ");
                _msg.Append(sked.MonthlyScheduleOrdinal.ToString());
                _msg.Append(" ");
                _msg.Append(sked.MonthlyScheduleDay.ToString());
            }
            _msg.Append("\r\n");


            _msg.Append("Schedule runs every:  ");
            _msg.Append(sked.DailyOccursEveryTimeInterval.ToString());
            _msg.Append(" day(s)");
            _msg.Append("\r\n");
            _msg.Append("Daily Frequency:      ");
            _msg.Append(sked.DailyFrequency.ToString());
            _msg.Append("\r\n");

            if (sked.DailyFrequency == enDailyFrequency.OneTime)
            {
                _msg.Append("Daily Run At:         ");
                _msg.Append(sked.OccursOnceAtTime.ToString());
                _msg.Append("\r\n");
            }
            else
            {
                _msg.Append("Daily occurs every:   ");
                _msg.Append(sked.DailyOccursEveryTimeInterval.ToString());
                _msg.Append(" ");
                _msg.Append(sked.DailyOccursTimeInterval.ToString());
                _msg.Append("\r\n");
                _msg.Append("Daily starting at:    ");
                _msg.Append(PFScheduler.FormatTimeSpan(sked.DailyOccursStartTime));
                _msg.Append("\r\n");
                _msg.Append("Daily ends at:        ");
                _msg.Append(PFScheduler.FormatTimeSpan(sked.DailyOccursEndTime));
                _msg.Append("\r\n");
            }

            _msg.Append("Test date:            ");
            _msg.Append(sked.TestCurrDateTime.ToString("MM/dd/yyyy HH:mm:ss"));
            _msg.Append("\r\n");
            _msg.Append("Actual result:        ");
            _msg.Append(lookupResult.ToString());
            _msg.Append("\r\n");
            _msg.Append("Expected test result: ");
            _msg.Append(sked.ExpectedTestResult.ToString());
            _msg.Append("\r\n");
            _msg.Append("Success/Failure:      ");
            if (sked.ExpectedTestResult == lookupResult)
            {
                _msg.Append("SUCCESS");
            }
            else
            {
                _msg.Append("FAIL");
            }
            _msg.Append("\r\n");
            Program._messageLog.WriteLine(_msg.ToString());
        }