コード例 #1
0
ファイル: DoctorTests.cs プロジェクト: yvelit/medical-clinic
        public static void Should_throw_a_exception_when_add_a_null_medical_appointment()
        {
            // arrange
            var doctor = new Doctor((Crm)"12345", "name", MedicalSpecialty.GeneralClinic);

            // act & assert
            Assert.Throws <ArgumentNullException>(() => doctor.AddMedicalAppointment(null));
        }
コード例 #2
0
ファイル: DoctorTests.cs プロジェクト: yvelit/medical-clinic
        public static void Should_parse_a_doctor_with_medical_appointments_into_a_string()
        {
            // arrange
            var doctor              = new Doctor((Crm)"12345", "name", MedicalSpecialty.GeneralClinic);
            var customer            = new Customer((Cpf)"012345678-90", "name", CustomerType.Normal);
            var medicalAppointment1 = new MedicalAppointment(DateTime.Now, MedicalAppointmentType.OnDemand, customer, doctor);
            var medicalAppointment2 = new MedicalAppointment(DateTime.Now, MedicalAppointmentType.OnDemand, customer, doctor);

            doctor.AddMedicalAppointment(medicalAppointment1);
            doctor.AddMedicalAppointment(medicalAppointment2);

            // act
            var result = doctor.ToString();

            // assert
            Assert.Equal($"CRM: 12345 - Nome: name - Consultas: [{medicalAppointment1},{medicalAppointment2}] - Valor Total: 128 - Especialidade médica: Clínica geral", result);
        }
コード例 #3
0
ファイル: DoctorTests.cs プロジェクト: yvelit/medical-clinic
        public static void Should_add_a_medical_appointment()
        {
            // arrange
            var doctor             = new Doctor((Crm)"12345", "name", MedicalSpecialty.GeneralClinic);
            var customer           = new Customer((Cpf)"012345678-90", "name", CustomerType.Normal);
            var medicalAppointment = new MedicalAppointment(DateTime.Now, MedicalAppointmentType.OnDemand, customer, doctor);

            // act
            doctor.AddMedicalAppointment(medicalAppointment);

            // assert
            Assert.True(!doctor.MedicalAppointments.IsEmpty());
            Assert.True(doctor.MedicalAppointments.Count() == 1);
            Assert.Equal(doctor.Code, doctor.MedicalAppointments.First().DoctorCode);
        }