public void GetPatient_ReturnsTheRequestedPatient()
        {
            // arrange
              var patient = new Patient { MedicalRecordNumber = Guid.NewGuid().ToString() };
              _patientRepository.CreatePatient(patient);

              // act
              var result = Assert.IsType<OkObjectResult>(_controller.GetPatient(patient.MedicalRecordNumber));

              // assert
              Assert.Equal(200, result.StatusCode);
              var returnedPatient = Assert.IsType<Patient>(result.Value);
              Assert.Equal(patient.MedicalRecordNumber, returnedPatient.MedicalRecordNumber);
        }
        public void PostPatient_AddsPatientToTheContext_AndReturnsThePatient()
        {
            // arrange
              var patient = new Patient { MedicalRecordNumber = Guid.NewGuid().ToString() };
              _patientRepository.CreatePatient(patient);

              // act
              var result = Assert.IsType<CreatedResult>(_controller.PostPatient(patient));

              // assert
              Assert.Equal(201, result.StatusCode);
              var returnedPatient = Assert.IsType<Patient>(result.Value);
              Assert.Equal(patient.MedicalRecordNumber, returnedPatient.MedicalRecordNumber);
              Assert.NotNull(_patientRepository.GetPatient(patient.MedicalRecordNumber));
        }
 public Patient CreatePatient(Patient patient)
 {
     _patientContext.Add(patient);
       return patient;
 }