public void GetSuccessfulAgeStatistic()
        {
            EventStorePatientEndSchedulingService eventEndService = SetupEventEndService();
            MinAvgMaxStatisticDTO endStatistic = eventEndService.SuccessfulSchedulingAgeStatistic();

            Assert.Equal(25, endStatistic.Average);
        }
Example #2
0
        public MinAvgMaxStatisticDTO SuccessfulSchedulingAgeStatistic()
        {
            MinAvgMaxStatisticDTO successfulSchedulingAgeStatistic = new MinAvgMaxStatisticDTO();

            try
            {
                IEnumerable <PatientEndSchedulingEvent> successfulScheduling = _patientEndSchedulingEventRepository.GetAll
                                                                                   (e => e.ReasonForEndOfAppointment == ReasonForEndOfAppointment.Success);

                successfulSchedulingAgeStatistic.Minimum = successfulScheduling.Min(e => e.UserAge);
                successfulSchedulingAgeStatistic.Average = (int)successfulScheduling.Average(e => e.UserAge);
                successfulSchedulingAgeStatistic.Maximum = successfulScheduling.Max(e => e.UserAge);
            }
            catch (Exception)
            {
                return(new MinAvgMaxStatisticDTO());
            }

            return(successfulSchedulingAgeStatistic);
        }
Example #3
0
        public MinAvgMaxStatisticDTO SuccessfulSchedulingDuration()
        {
            MinAvgMaxStatisticDTO minAvgMaxStatisticDTO = new MinAvgMaxStatisticDTO();

            try
            {
                IEnumerable <TimeSpan> successfulSchedulingDuration = _patientEndSchedulingEventRepository.GetAll
                                                                          (e => e.ReasonForEndOfAppointment == ReasonForEndOfAppointment.Success).
                                                                      Select(e => e.TriggerTime - e.StartSchedulingEventTime);

                minAvgMaxStatisticDTO.Minimum = (int)successfulSchedulingDuration.Min(t => t.TotalMinutes);
                minAvgMaxStatisticDTO.Average = (int)successfulSchedulingDuration.Average(t => t.TotalMinutes);
                minAvgMaxStatisticDTO.Maximum = (int)successfulSchedulingDuration.Max(t => t.TotalMinutes);
            }
            catch (Exception)
            {
                new MinAvgMaxStatisticDTO();
            }

            return(minAvgMaxStatisticDTO);
        }