コード例 #1
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void Start2JobsAndCheckStartTimes()
        {
            //Setup
            Job job1 = new Job("job1");
            Job job2 = new Job("job2");

            //Execute
            DateTime startTime1 = new DateTime(2001, 1, 1, 1, 1, 1);
            job1.start(startTime1);

            DateTime startTime2 = new DateTime(2002, 2, 2, 2, 2, 2);
            job2.start(startTime2);

            //Test
            Assert.AreEqual<DateTime>(startTime1, job1.startTime);
            Assert.AreEqual<DateTime>(startTime2, job2.startTime);
        }
コード例 #2
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void CurrentWorkingTime()
        {
            //Setup
            string jobname = "CurrentWorkingTime";
            Job job = new Job(jobname);

            //Execute
            DateTime startTime = new DateTime(2000, 1, 1, 1, 1, 1);
            job.start(startTime);

            //Test
            DateTime currentTime = new DateTime(2000, 1, 1, 2, 2, 2);
            Assert.AreEqual<TimeSpan>(new TimeSpan(1, 1, 1), job.currentWorkingTime(currentTime));

            currentTime = new DateTime(2000, 1, 1, 3, 3, 3);
            Assert.AreEqual<TimeSpan>(new TimeSpan(2, 2, 2), job.currentWorkingTime(currentTime));

            //Execute
            DateTime endTime = new DateTime(2000, 1, 1, 4, 4, 4);
            job.stop(endTime);

            Assert.AreEqual<TimeSpan>(new TimeSpan(0), job.currentWorkingTime(currentTime));
        }
コード例 #3
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void StartAndStopAndStart()
        {
            //Setup
            Job job = new Job("job");
            DateTime startTime = new DateTime(2001, 1, 1, 1, 1, 1);
            DateTime endTime = new DateTime(2001, 1, 1, 2, 1, 1);

            //Test
            Assert.IsFalse(job.isRunning);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.startTime);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.endTime);

            //Execute
            job.start(startTime);

            //Test
            Assert.IsTrue(job.isRunning);
            Assert.AreEqual<DateTime>(startTime, job.startTime);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.endTime);

            //Execute
            job.stop(endTime);

            //Test
            Assert.IsFalse(job.isRunning);
            Assert.AreEqual<DateTime>(startTime, job.startTime);
            Assert.AreEqual<DateTime>(endTime, job.endTime);

            //Execute
            DateTime startTime2 = new DateTime(2002, 1, 1, 1, 1, 1);
            job.start(startTime2);

            //Test
            Assert.IsTrue(job.isRunning);
            Assert.AreEqual<DateTime>(startTime2, job.startTime);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.endTime);
        }
コード例 #4
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void totalWorkingTime()
        {
            //Setup
            string jobname = "TotalWorkingTime";
            Job job = new Job(jobname);

            //Execute
            DateTime startTime = new DateTime(2000, 1, 1, 1, 1, 1);
            DateTime endTime = new DateTime(2000, 1, 1, 2, 2, 2);
            job.start(startTime);
            job.stop(endTime);

            //Test
            Assert.AreEqual<string>("01:01:01", job.totalWorkingTime);

            //Execute
            startTime = new DateTime(2000, 1, 1, 3, 3, 3);
            endTime = new DateTime(2000, 1, 1, 4, 4, 4);
            job.start(startTime);
            job.stop(endTime);

            Assert.AreEqual<string>("02:02:02", job.totalWorkingTime);
        }
コード例 #5
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void StopJobAndCheckStartAndStopTime()
        {
            //Setup
            Job job = new Job("job");
            DateTime startTime = new DateTime(2001, 1, 1, 1, 1, 1);
            DateTime endTime = new DateTime(2001, 1, 1, 2, 1, 1);

            //Execute
            job.start(startTime);

            //Test
            Assert.AreEqual<DateTime>(startTime, job.startTime);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.endTime);

            //Execute
            job.stop(endTime);

            //Test
            Assert.AreEqual<DateTime>(startTime, job.startTime);
            Assert.AreEqual<DateTime>(endTime, job.endTime);
        }
コード例 #6
0
ファイル: JobTests.cs プロジェクト: ebibibi/TimeLog
        public void StartJobAndCheckStartTime()
        {
            //Setup
            string jobname = "StartJobTest";
            Job job = new Job(jobname);

            //Execute
            DateTime startTime = new DateTime(2000, 1, 1, 1, 1, 1);
            job.start(startTime);

            //Test
            Assert.AreEqual<DateTime>(startTime, job.startTime);
            Assert.IsTrue(job.isRunning);
            Assert.AreEqual<DateTime>(TimeHelper.Null(), job.endTime);
        }