Exemplo n.º 1
0
        public void Map_appointment_persistance_to_appointment_entity_when_persistance_is_null()
        {
            AppointmentPersistence appointmentsPersistance = null;

            Assert.Throws <ArgumentNullException>(()
                                                  => AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance));
        }
        private bool IsEqualAppointmentPersistanceAndAppointmentEntity(AppointmentPersistence appointmentPersistence, Appointment appointment)
        {
            if (appointmentPersistence.Id != appointment.Id)
            {
                return(false);
            }

            if (appointmentPersistence.DoctorPersistanceId != appointment.DoctorId)
            {
                return(false);
            }

            if (appointmentPersistence.PatientPersistanceId != appointment.PatientId)
            {
                return(false);
            }

            if (DateTime.Compare(appointmentPersistence.DateRange.StartDateTime, appointment.DateRange.StartDateTime) != 0)
            {
                return(false);
            }

            if (DateTime.Compare(appointmentPersistence.DateRange.StartDateTime, appointment.DateRange.StartDateTime) != 0)
            {
                return(false);
            }

            if (appointmentPersistence.IsCanceled != appointment.IsCanceled)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public void Map_appointment_persistence_to_appointment_entity()
        {
            AppointmentPersistence appointmentsPersistance = this.GetAppointmentPersistanceFirst();

            Appointment appointments = AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance);

            Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance, appointments));
        }
Exemplo n.º 4
0
 public static Appointment MapAppointmentsPersistenceToAppointmentsEntity(AppointmentPersistence appointments)
 => appointments == null ? throw new ArgumentNullException()
                                 : new Appointment()
 {
     Id            = appointments.Id,
     StartDateTime = appointments.StartDateTime,
     EndDateTime   = appointments.EndDateTime,
     Type          = appointments.Type,
     DoctorId      = appointments.DoctorPersistanceId,
     PatientId     = appointments.PatientPersistanceId,
     IsCanceled    = appointments.IsCanceled
 };
Exemplo n.º 5
0
        public static AppointmentPersistence MapAppointmentEntityToAppointmentPersistence(Appointment appointment)
        {
            if (appointment == null)
            {
                return(null);
            }

            AppointmentPersistence retVal = new AppointmentPersistence()
            {
                Id = appointment.Id, StartDateTime = appointment.StartDateTime, EndDateTime = appointment.EndDateTime, Type = appointment.Type, DoctorPersistanceId = appointment.DoctorId, PatientPersistanceId = appointment.PatientId, IsCanceled = appointment.IsCanceled
            };

            return(retVal);
        }
Exemplo n.º 6
0
 public static Appointment MapAppointmentsPersistenceToAppointmentsEntity(AppointmentPersistence appointments)
 => appointments == null ? throw new ArgumentNullException()
                                 : new Appointment(appointments.Id,
                                                   new DateRange(appointments.DateRange.StartDateTime, appointments.DateRange.EndDateTime),
                                                   appointments.DoctorPersistanceId, appointments.PatientPersistanceId,
                                                   appointments.IsCanceled);