public async Task <DoctorViewModel> AddDoctorAsync(DoctorViewModel doctorViewModel) { try { Doctor doctor = await this.repo.AddDoctorAsync(doctorViewModel.ToEntity()); doctorViewModel.ToModel(doctor); return(doctorViewModel); } catch (Exception ex) { throw ex; } }
public void ToModel_ViewModelEqualsDoctor() { Doctor testDoctor = new Doctor { DoctorId = 1, FirstName = "Andrew", LastName = "Moshko", MiddleName = "Victor", Age = "18", Weight = "83", Height = "195", Email = "*****@*****.**", PhoneNumber = "+380995135682", HomeNumber = "-", Sex = "man", Condition = "test doctor", Text = "default string" }; DoctorViewModel doctor = new DoctorViewModel(); doctor.ToModel(testDoctor); Assert.Equal(doctor.DoctorId, testDoctor.DoctorId); Assert.Equal(doctor.FirstName, testDoctor.FirstName); Assert.Equal(doctor.LastName, testDoctor.LastName); Assert.Equal(doctor.MiddleName, testDoctor.MiddleName); Assert.Equal(doctor.Age, testDoctor.Age); Assert.Equal(doctor.Weight, testDoctor.Weight); Assert.Equal(doctor.Height, testDoctor.Height); Assert.Equal(doctor.PhoneNumber, testDoctor.PhoneNumber); Assert.Equal(doctor.HomeNumber, testDoctor.HomeNumber); Assert.Equal(doctor.Sex, testDoctor.Sex); Assert.Equal(doctor.Condition, testDoctor.Condition); Assert.Equal(doctor.Text, testDoctor.Text); //Assert.Equal(doctor.IsActive, testDoctor.IsActive); }