Пример #1
0
 public void MustCalculateTotalWorkedHoursByResourceWhenMissesEndDatesWithoutEmergencyResponseWithMultipleValues()
 {
     //Arrange
     CS_DPIResource dpiResources = new CS_DPIResource() { ID = 1 };
     List<DPICallLogVO> startCallLog = new List<DPICallLogVO>();
     List<DPICallLogVO> endCallLog = new List<DPICallLogVO>();
     startCallLog.Add(
         new DPICallLogVO()
         {
             ID = 1,
             ActionTime = DateTime.Now.AddHours(-10)
         });
     startCallLog.Add(
         new DPICallLogVO()
         {
             ID = 2,
             ActionTime = DateTime.Now.AddHours(-8)
         });
     endCallLog.Add(new DPICallLogVO()
     {
         ID = 3,
         ActionTime = DateTime.Now.AddHours(-6)
     });
     endCallLog.Add(new DPICallLogVO()
     {
         ID = 4,
         ActionTime = DateTime.Now.AddHours(-4)
     });
     startCallLog.Add(new DPICallLogVO()
     {
         ID = 4,
         ActionTime = DateTime.Now.AddHours(-2)
     });
     DPIModel model = new DPIModel();
     //Act
     model.CalculateHoursForResouce(dpiResources, false, new DateTime(), startCallLog, endCallLog, DateTime.Now.Date);
     //Assert
     Assert.AreEqual(Convert.ToInt32(6 + DateTime.Now.Subtract(startCallLog[2].ActionTime).TotalHours), Convert.ToInt32(dpiResources.Hours));
 }
Пример #2
0
        public void MustCalculateTotalWorkedHoursByResourceWhenMissesEndDateWithEmergencyResponse()
        {
            //Arrange
            DateTime currentDate = DateTime.Now.Date.AddHours(3);
            CS_DPIResource dpiResources = new CS_DPIResource() { ID = 1 };
            List<DPICallLogVO> startCallLog = new List<DPICallLogVO>();
            List<DPICallLogVO> endCallLog = new List<DPICallLogVO>();
            startCallLog.Add(
                new DPICallLogVO()
                {
                    ID = 1,
                    ActionTime = currentDate.AddHours(-10)
                });
            endCallLog.Add(new DPICallLogVO()
            {
                ID = 2,
                ActionTime = currentDate.AddHours(-8)
            });
            endCallLog.Add(new DPICallLogVO()
            {
                ID = 3,
                ActionTime = currentDate.AddHours(-6)
            });
            startCallLog.Add(new DPICallLogVO()
            {
                ID = 4,
                ActionTime = currentDate.AddHours(-4)
            });

            DPIModel model = new DPIModel();

            //Act
            model.CalculateHoursForResouce(
                dpiResources, true,
                currentDate.AddHours(-10),
                startCallLog,
                endCallLog,
                currentDate.Date.AddDays(-1));

            //Assert
            Assert.AreEqual(5, Math.Round(dpiResources.Hours, 2)
            );
        }
Пример #3
0
 public void MustCalculateTotalWorkedHoursByResourceWhenStartAndEndDatesMatchWithEmergencyResponse()
 {
     //Arrange
     CS_DPIResource dpiResources = new CS_DPIResource() { ID = 1 };
     List<DPICallLogVO> startCallLog = new List<DPICallLogVO>();
     List<DPICallLogVO> endCallLog = new List<DPICallLogVO>();
     startCallLog.Add(new DPICallLogVO() { ID = 1, ActionTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 0, 0) });
     endCallLog.Add(new DPICallLogVO() { ID = 2, ActionTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 0, 0) });
     endCallLog.Add(new DPICallLogVO() { ID = 3, ActionTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, 0, 0) });
     DPIModel model = new DPIModel();
     //Act
     model.CalculateHoursForResouce(dpiResources, true, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 0, 0), startCallLog, endCallLog, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0));
     //Assert
     Assert.AreEqual(4, dpiResources.Hours);
 }
Пример #4
0
 public void MustCalculateTotalWorkedHoursByResourceWhenStartAndEndDatesMatchWithoutEmergencyResponseWithMultipleValues()
 {
     //Arrange
     CS_DPIResource dpiResources = new CS_DPIResource() { ID = 1 };
     List<DPICallLogVO> startCallLog = new List<DPICallLogVO>();
     List<DPICallLogVO> endCallLog = new List<DPICallLogVO>();
     startCallLog.Add(new DPICallLogVO() { ID = 1, ActionTime = new DateTime(2011, 8, 9, 8, 0, 0) });
     startCallLog.Add(new DPICallLogVO() { ID = 3, ActionTime = new DateTime(2011, 8, 9, 9, 0, 0) });
     endCallLog.Add(new DPICallLogVO() { ID = 2, ActionTime = new DateTime(2011, 8, 9, 12, 0, 0) });
     startCallLog.Add(new DPICallLogVO() { ID = 1, ActionTime = new DateTime(2011, 8, 9, 14, 0, 0) });
     endCallLog.Add(new DPICallLogVO() { ID = 4, ActionTime = new DateTime(2011, 8, 9, 18, 0, 0) });
     DPIModel model = new DPIModel();
     //Act
     model.CalculateHoursForResouce(dpiResources, false, new DateTime(), startCallLog, endCallLog, new DateTime(2011, 8, 9, 0, 0, 0));
     //Assert
     Assert.AreEqual(8, dpiResources.Hours);
 }
Пример #5
0
 public void MustCalculateTotalWorkedHoursByResourceWhenMissesEndDateWithoutEmergencyResponse()
 {
     //Arrange
     CS_DPIResource dpiResources = new CS_DPIResource() { ID = 1 };
     List<DPICallLogVO> startCallLog = new List<DPICallLogVO>();
     List<DPICallLogVO> endCallLog = new List<DPICallLogVO>();
     startCallLog.Add(
         new DPICallLogVO()
         {
             ID = 1,
             ActionTime = DateTime.Now.AddHours(-6)
         });
     endCallLog.Add(new DPICallLogVO()
     {
         ID = 2,
         ActionTime = DateTime.Now.AddHours(-4)
     });
     startCallLog.Add(new DPICallLogVO()
     {
         ID = 3,
         ActionTime = DateTime.Now.AddHours(-2)
     });
     DPIModel model = new DPIModel();
     //Act
     model.CalculateHoursForResouce(dpiResources, false, new DateTime(), startCallLog, endCallLog, DateTime.Now.Date);
     //Assert
     Assert.AreEqual(Math.Round(Convert.ToDecimal(2 + DateTime.Now.Subtract(startCallLog[1].ActionTime).TotalHours), 2), Math.Round(dpiResources.Hours, 2));
 }