コード例 #1
0
        public void AnalyzeByDayTest()
        {
            TaskEntryAnalyzer taskEntryAnalyzer =
                new TaskEntryAnalyzer(
                    new[]
                        {
                            new TaskStartEndEntry(
                                new DateTime(2014, 6, 7),
                                "taskcode",
                                new DateTime(2000, 1, 1, 10, 0, 0, 0),
                                new DateTime(2000, 1, 1, 11, 0, 0, 0))
                        });

            List<WorkDay> workDays = taskEntryAnalyzer.AnalyzeByDay();

            Assert.AreEqual(1, workDays.Count);
            Assert.AreEqual(new TimeSpan(0, 1, 0, 0), workDays[0].TotalDuration);
        }
コード例 #2
0
        public void AnalyzeByDayTest3()
        {
            TaskEntryAnalyzer taskEntryAnalyzer =
                new TaskEntryAnalyzer(
                    new[]
                        {
                            new TaskStartEndEntry(
                                new DateTime(2014, 6, 7),
                                "taskcode",
                                new DateTime(2000, 1, 1, 10, 0, 0, 0),
                                new DateTime(2000, 1, 1, 11, 0, 0, 0)),
                            new TaskStartEndEntry(
                                new DateTime(2014, 6, 7),
                                "taskcode",
                                new DateTime(2000, 1, 1, 11, 0, 0, 0),
                                new DateTime(2000, 1, 1, 12, 30, 0, 0)),
                            new TaskStartEndEntry(
                                new DateTime(2014, 6, 8),
                                "taskcode",
                                new DateTime(2000, 1, 1, 11, 0, 0, 0),
                                new DateTime(2000, 1, 1, 12, 30, 0, 0))
                        });

            WorkDay[] workDays = taskEntryAnalyzer.AnalyzeByDay().OrderBy(wd => wd.Date).ToArray();

            Assert.AreEqual(2, workDays.Count());
            Assert.AreEqual(new TimeSpan(0, 2, 30, 0), workDays[0].TotalDuration);
            Assert.AreEqual(new TimeSpan(0, 1, 30, 0), workDays[1].TotalDuration);
        }