public void ValidateOverlappingTaskYieldAnErrorTest()
        {
            TaskStartEndEntry taskStartEndEntry1 = new TaskStartEndEntry(
                new DateTime(2014, 6, 7),
                "taskcode1",
                new DateTime(2000, 1, 1, 10, 30, 0, 0),
                new DateTime(2000, 1, 1, 11, 30, 0, 0));

            TaskStartEndEntry taskStartEndEntry2 = new TaskStartEndEntry(
                new DateTime(2014, 6, 7),
                "taskcode2",
                new DateTime(2000, 1, 1, 10, 0, 0, 0),
                new DateTime(2000, 1, 1, 11, 0, 0, 0));

            TaskEntryAnalyzer taskEntryAnalyzer = new TaskEntryAnalyzer(
                new[] { taskStartEndEntry1, taskStartEndEntry2 });

            List<AnalyzerError> errors = taskEntryAnalyzer.Validate();

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual(2, errors[0].TaskEntries.Length);
            CollectionAssert.AreEquivalent(new TaskEntry[]{taskStartEndEntry1, taskStartEndEntry2}, errors[0].TaskEntries );
            Assert.AreEqual(AnalyzerErrorType.OverlappingTasks, errors[0].ErrorType);
        }
        public void ValidateInTwoDifferentDayShouldNoYieldAnErrorTest()
        {
            TaskStartEndEntry taskStartEndEntry1 = 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));
            TaskStartEndEntry taskStartEndEntry2 = new TaskStartEndEntry(
               new DateTime(2014, 6, 8),
               "taskcode",
               new DateTime(2000, 1, 1, 10, 0, 0, 0),
               new DateTime(2000, 1, 1, 11, 0, 0, 0));
            TaskEntryAnalyzer taskEntryAnalyzer =
                new TaskEntryAnalyzer(
                    new[]
                        {
                            taskStartEndEntry1,
                            taskStartEndEntry2
                        });

            List<AnalyzerError> errors = taskEntryAnalyzer.Validate();

            Assert.AreEqual(0, errors.Count);
        }
        public void ValidateNotOverlappingTaskYieldAnErrorTest()
        {
            TaskStartEndEntry taskStartEndEntry1 = new TaskStartEndEntry(
                new DateTime(2014, 6, 7),
                "taskcode1",
                new DateTime(2000, 1, 1, 10, 30, 0, 0),
                new DateTime(2000, 1, 1, 11, 30, 0, 0));

            TaskStartEndEntry taskStartEndEntry2 = new TaskStartEndEntry(
                new DateTime(2014, 6, 7),
                "taskcode2",
                new DateTime(2000, 1, 1, 11, 30, 0, 0),
                new DateTime(2000, 1, 1, 12, 0, 0, 0));

            TaskEntryAnalyzer taskEntryAnalyzer = new TaskEntryAnalyzer(
                new[] { taskStartEndEntry1, taskStartEndEntry2 });

            List<AnalyzerError> errors = taskEntryAnalyzer.Validate();

            Assert.AreEqual(0, errors.Count);
        }
        public void ValidateEndDateBeforeStartDateShouldYieldAnErrorTest()
        {
            TaskStartEndEntry taskStartEndEntry = new TaskStartEndEntry(
                new DateTime(2014, 6, 7),
                "taskcode",
                new DateTime(2000, 1, 1, 11, 0, 0, 0),
                new DateTime(2000, 1, 1, 10, 0, 0, 0));
            TaskEntryAnalyzer taskEntryAnalyzer =
                new TaskEntryAnalyzer(
                    new[]
                        {
                            taskStartEndEntry
                        });

            List<AnalyzerError> errors = taskEntryAnalyzer.Validate();

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual(1, errors[0].TaskEntries.Length);
            Assert.AreEqual(taskStartEndEntry, errors[0].TaskEntries[0]);
            Assert.AreEqual(AnalyzerErrorType.StartAfterEndError, errors[0].ErrorType);
        }