예제 #1
0
        public async Task UpdatePatient_CreationOk(string name, string lastname, string email, string medicalNumber)
        {
            Guid id = new Guid("6667cc4b-0efb-45c1-a57b-0d3089103e7b");

            // Arrange
            await this.Authorize().ConfigureAwait(false);

            PatientViewModel patientToUpdate = new PatientViewModel
            {
                Email = email, Id = id, Surname = lastname, Name = name, MedicalNumber = medicalNumber
            };

            // Act
            HttpResponseMessage response = await this.CallUpdatePatient(patientToUpdate).ConfigureAwait(false);

            response.EnsureSuccessStatusCode();
            PatientViewModel patient =
                JsonConvert.DeserializeObject <PatientViewModel>(await response.Content.ReadAsStringAsync()
                                                                 .ConfigureAwait(false));

            // Assert
            Assert.NotNull(patient);
            patient.Should().NotBeEquivalentTo(KnownPatients.First(p => p.Id == id));
            patient.Should().BeEquivalentTo(patientToUpdate);
        }
예제 #2
0
        public async Task GetPatient_NotFound()
        {
            Guid id = Guid.NewGuid();

            // Arrange
            await this.Authorize().ConfigureAwait(false);

            // Act
            HttpResponseMessage response = await this.CallGetPatient(id).ConfigureAwait(false);

            response.EnsureSuccessStatusCode();

            PatientViewModel patient =
                JsonConvert.DeserializeObject <PatientViewModel>(await response.Content.ReadAsStringAsync()
                                                                 .ConfigureAwait(false));

            // Assert
            patient.Should().BeNull();
        }
예제 #3
0
        public async Task GetPatient_Found(string idGuid)
        {
            Guid id = new Guid(idGuid);

            // Arrange
            await this.Authorize().ConfigureAwait(false);

            // Act
            HttpResponseMessage response = await this.CallGetPatient(id).ConfigureAwait(false);

            response.EnsureSuccessStatusCode();

            PatientViewModel patient =
                JsonConvert.DeserializeObject <PatientViewModel>(await response.Content.ReadAsStringAsync()
                                                                 .ConfigureAwait(false));

            // Assert
            Assert.NotNull(patient);
            patient.Should().BeEquivalentTo(KnownPatients.First(p => p.Id == id));
        }
예제 #4
0
 public void DataIsUploadExceptEmail(PatientViewModel patientToUpdate, PatientViewModel patient)
 {
     patientToUpdate.MedicalNumber = "UNDEFINED";
     patient.MedicalNumber.Should().NotBeSameAs(patientToUpdate.MedicalNumber);
     patient.Should().BeEquivalentTo(patientToUpdate, config => config.Excluding(p => p.MedicalNumber));
 }