Пример #1
0
        public void TestDefaultTime_NoExtraNoMissing()
        {
            // Arrange
            var day = new DayEntry(_userId, DateTime.Now);

            var point1 = new TimeEntry(day.Id, new DateTime(2020, 10, 1, 8, 0, 0));
            var point2 = new TimeEntry(day.Id, new DateTime(2020, 10, 1, 11, 56, 0));

            // Act
            day.AddPoint(point1, configuration);
            day.AddPoint(point2, configuration);

            // Test
            Assert.Equal(new TimeSpan(0, 0, 0), day.MissingTime);
            Assert.Equal(new TimeSpan(0, 0, 0), day.ExtraTime);
        }
Пример #2
0
        public void TestMultiplePoints()
        {
            // Arrange
            var day = new DayEntry(_userId, DateTime.Now);

            var point1 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 9, 1, 0));
            var point2 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 16, 42, 0));
            var point3 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 16, 44, 0));
            var point4 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 16, 48, 0));
            var point5 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 17, 49, 0));
            var point6 = new TimeEntry(day.Id, new DateTime(2020, 10, 17, 18, 2, 0));

            var lunchTime     = new TimeSpan(1, 0, 0);
            var toleranceTime = new TimeSpan(0, 10, 0);
            var workingTime   = new TimeSpan(8, 0, 0);
            var config        = new Configuration(_userId, lunchTime, toleranceTime, workingTime);

            // Act
            day.AddPoint(point1, config);
            day.AddPoint(point2, config);
            day.AddPoint(point3, config);
            day.AddPoint(point4, config);
            day.AddPoint(point5, config);
            day.AddPoint(point6, config);

            // Test
            Assert.Equal(new TimeSpan(0, 0, 0), day.MissingTime);
            Assert.Equal(new TimeSpan(0, 0, 0), day.ExtraTime);
        }