Example #1
0
        public static void Should_throw_exception_when_add_an_existent_doctor_in_medical_clinic()
        {
            // arrange
            var medicalClinic    = new MedicalClinic();
            var crm              = (Crm)"12345";
            var name             = "name";
            var medicalSpecialty = MedicalSpecialty.GeneralClinic;

            medicalClinic.AddDoctor(crm, name, medicalSpecialty);

            // act & assert
            Assert.Throws <InvalidOperationException>(() => medicalClinic.AddDoctor(crm, name, medicalSpecialty));
        }
Example #2
0
        public static void Should_add_a_doctor_in_medical_clinic()
        {
            // arrange
            var medicalClinic = new MedicalClinic();

            // act
            medicalClinic.AddDoctor((Crm)"12345", "name", MedicalSpecialty.GeneralClinic);

            // assert
            Assert.Equal(1, medicalClinic.CountDoctor());
        }
Example #3
0
        public static void Should_throw_exception_when_add_an_existent_medical_appointment_in_medical_clinic()
        {
            // arrange
            var medicalClinic = new MedicalClinic();
            var cpf           = (Cpf)"123456789-10";

            medicalClinic.AddCustomer(cpf, "name", CustomerType.Normal);
            var crm = (Crm)"12345";

            medicalClinic.AddDoctor(crm, "name", MedicalSpecialty.Orthopedy);
            var date = DateTime.Now;

            medicalClinic.AddMedicalAppointment(date, MedicalAppointmentType.OnDemand, cpf, crm);

            // act & assert
            Assert.Throws <InvalidOperationException>(() => medicalClinic.AddMedicalAppointment(date, MedicalAppointmentType.OnDemand, cpf, crm));
        }
Example #4
0
        public static void Should_add_a_medical_appointment_in_medical_clinic()
        {
            // arrange
            var medicalClinic = new MedicalClinic();
            var cpf           = (Cpf)"123456789-10";

            medicalClinic.AddCustomer(cpf, "name", CustomerType.Normal);
            var crm = (Crm)"12345";

            medicalClinic.AddDoctor(crm, "name", MedicalSpecialty.Orthopedy);

            // act
            medicalClinic.AddMedicalAppointment(DateTime.Now, MedicalAppointmentType.OnDemand, cpf, crm);

            // assert
            Assert.Equal(1, medicalClinic.CountMedicalAppointment());
        }
Example #5
0
        private static void LoadDoctorsFromFile()
        {
            var lines = LoadFromFile();

            Console.WriteLine("Carregando...");
            int failCounter = 0;

            foreach (string line in lines)
            {
                var temp = line.Split(';');
                try
                {
                    _medicalClinic.AddDoctor(
                        new Crm(temp[0]),
                        temp[1],
                        (MedicalSpecialty)int.Parse(temp[2]));
                }
                catch (System.Exception)
                {
                    failCounter++;
                }
            }
            Console.WriteLine($"Foram carregados {_medicalClinic.CountDoctor()} médicos, {failCounter} falharam");
        }