示例#1
0
        private void SubmitBtn_Click(object sender, System.EventArgs e)
        {
            Time start = new Time(startTimeDTP.Value.Hour, startTimeDTP.Value.Minute);
            Time end   = new Time(endTimeDTP.Value.Hour, endTimeDTP.Value.Minute);
            Log  log   = new Log(dateDTP.Value.Year, dateDTP.Value.Month, dateDTP.Value.Day, start, end);

            currentJob.AddLog(log);
            submitted = true;
            this.Close();
        }
示例#2
0
        public static void AddLog_SameOverlappingException()
        {
            Time start = new Time(3, 30);
            Time end   = new Time(23, 30);
            Log  log1  = new Log(2019, 2, 28, start, end);

            Job job = new Job("Janitor");

            job.AddLog(log1);
            Assert.Throws <ArgumentException>(() => job.AddLog(log1));
        }
示例#3
0
        public static void AddLog_DifferentOverlappingException(int starth, int startm, int endh, int endm,
                                                                int start2h, int start2m, int end2h, int end2m)
        {
            Time start = new Time(starth, startm);
            Time end   = new Time(endh, endm);
            Log  log1  = new Log(2019, 2, 28, start, end);

            Time start2 = new Time(start2h, start2m);
            Time end2   = new Time(end2h, end2m);
            Log  log2   = new Log(2019, 2, 28, start2, end2);

            Job job = new Job("Janitor");

            job.AddLog(log1);
            Assert.Throws <ArgumentException>(() => job.AddLog(log2));
        }
示例#4
0
        public static void AddLog_Single()
        {
            Job job = new Job("Janitor");

            Time start = new Time(3, 30);
            Time end   = new Time(23, 30);
            Log  log   = new Log(2023, 12, 5, start, end);

            job.AddLog(log);

            Assert.Equal(log, job.Find((l) => l.Equals(log)));
        }
示例#5
0
        public static void AddLog_Many()
        {
            Job job = new Job("Janitor");

            Time start = new Time(3, 30);
            Time end   = new Time(23, 30);

            Log[] logs = new Log[1000];

            for (int x = 0; x < 1000; ++x)
            {
                logs[x] = new Log(x + 1, x % 12 + 1, x % 28 + 1, start, end);
                job.AddLog(logs[x]);
            }

            for (int x = 0; x < 1000; ++x)
            {
                Assert.Equal(logs[x], job.Find(l => l.Equals(logs[x])));
            }
        }