public void Create_PeriodWithoutTimeReport_Returns1Report()
        {
            var report = CreateReportWithoutTime();

            var builder = new KMDAbsenceReportBuilder();

            var list = builder.Create(report);

            Assert.AreEqual(1, list.Count);
        }
        public void Create_Report_ReturnsCreateOperation()
        {
            var report = CreateReportWithoutTime();

            var builder = new KMDAbsenceReportBuilder();

            var list = builder.Create(report);

            Assert.AreEqual(KMDAbsenceOperation.Create, list.First().KmdAbsenceOperation);
        }
        public void Create_PeriodeWithStartAndEndTimeReport_Returns3Reports()
        {
            var report = CreateReportWithTime();

            var builder = new KMDAbsenceReportBuilder();

            var list = builder.Create(report);

            Assert.AreEqual(3, list.Count);
        }
        public void Create_PeriodWithoutTimeReport_SetsOperationToCreate()
        {
            var report = CreateReportWithoutTime();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list.First();

            Assert.AreEqual(KMDAbsenceOperation.Create, absence.KmdAbsenceOperation);
        }
        public void Create_SameDayWithTimeReport_StartAndEndDateAreEqual()
        {
            var report = CreateReportWithTime();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list.First();

            Assert.True(absence.StartDate.Date == absence.EndDate.Date);
        }
        public void Create_PeriodeWithStartAndEndTimeReport_CenterAbsencePeriodIsDecremented()
        {
            var report = CreateReportWithTime();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list[1];

            Assert.AreEqual(report.StartTimestamp.ToDateTime().AddDays(1), absence.StartDate);
            Assert.AreEqual(report.EndTimestamp.ToDateTime().AddDays(-1), absence.EndDate);
        }
        public void Create_PeriodeWithStartAndEndTimeReport_EndAbsenceHasStartTimeSet()
        {
            var report = CreateReportWithTime();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list.First();

            Assert.AreEqual(report.StartTime, absence.StartTime);
            Assert.AreEqual(null, absence.EndTime);
        }
        public void Create_PeriodWithoutTimeReport_TimeIsNull()
        {
            var report = CreateReportWithoutTime();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list.First();

            Assert.AreEqual(null, absence.StartTime);
            Assert.AreEqual(null, absence.EndTime);
        }
        public void Create_SameDayWithTimeReport_Returns1Report()
        {
            var report = CreateReportWithTime();

            report.StartTimestamp = new DateTime(2016, 10, 10).ToTimestamp();
            report.EndTimestamp   = new DateTime(2016, 10, 10).ToTimestamp();

            var builder = new KMDAbsenceReportBuilder();

            var list = builder.Create(report);

            Assert.AreEqual(1, list.Count);
        }
        public void Create_SameDayWithTimeReport_SetsTime()
        {
            var report = CreateReportWithTime();

            report.StartTimestamp = new DateTime(2016, 10, 10).ToTimestamp();
            report.EndTimestamp   = new DateTime(2016, 10, 10).ToTimestamp();

            var builder = new KMDAbsenceReportBuilder();

            var list    = builder.Create(report);
            var absence = list.First();

            Assert.AreEqual(report.StartTime, absence.StartTime);
            Assert.AreEqual(report.EndTime, absence.EndTime);
        }