public void Given_PatientHistoryRepository_When_EditingAPatientHistory_Then_ThePatientHistoryShouldBeProperlyEdited()
        {
            var doctor  = Doctor.Create("Daniel", "Oana", "*****@*****.**", "parola", "0746524459", "ads", "Cardiologie", "Sf. Spiridon", "Iasi", "Str. Vasile Lupu");
            var patient = Patient.Create("Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", new DateTime(1996, 02, 10), "0746524459", null);

            RunOnDatabase(async ctx => {
                //Arrange
                var repository     = new PatientHistoryRepository(ctx);
                var patientHistory = PatientHistory.Create(patient, doctor, "Paracetamol", "Febra", "Odihna", new DateTime(1996, 02, 10));
                await repository.AddAsync(patientHistory);

                var prescription = patientHistory.Prescription;
                patientHistory.Update(patient, doctor, "Fervex", "Febra", "Odihna", new DateTime(1996, 02, 10));
                var newPrescription = patientHistory.Prescription;

                //Act
                await repository.UpdateAsync(patientHistory);

                //Assert
                Assert.AreNotEqual(prescription, newPrescription);
            });
        }
Пример #2
0
        public void Given_PatientHistoryRepository_When_EditingAPatientHistory_Then_ThePatientHistoryShouldBeProperlyEdited()
        {
            var patient = Patient.Create("1234", "Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", "Romania", new DateTime(1996, 02, 10), "0746524459", null);
            var doctor  = Doctor.Create("1234", "Mircea", "Cartarescu", "*****@*****.**", "parola", "0746524459", "blasdadsadsada", "Cardiologie", "Sf. Spiridon", "Iasi", "Romania", "Str. Vasile Lupu", true);

            RunOnDatabase(async ctx => {
                //Arrange
                var repository     = new PatientHistoryRepository(ctx);
                var patientHistory = PatientHistory.Create(patient.PatientId);
                await repository.AddAsync(patientHistory);

                var drink = patientHistory.Drink;
                patientHistory.Update(null, null, null, null, null, null, null, null, null);
                var newDrink = patientHistory.Drink;

                //Act
                await repository.UpdateAsync(patientHistory);

                //Assert
                Assert.AreNotEqual(drink, newDrink);
            });
        }