예제 #1
0
        public async Task AddPatient_ExceptionResult()
        {
            PatientLogic patientLogic = new PatientLogic(this.patRepo.Object);

            PatientViewModel model = new PatientViewModel();

            await Assert.ThrowsAsync <Exception>(async() =>
            {
                var result = await patientLogic.AddPatientAsync(model);
            });
        }
예제 #2
0
        public async Task AddPatient_SuccessResult()
        {
            PatientLogic patientData = new PatientLogic(this.patRepo.Object);

            // Create model
            PatientViewModel model = new PatientViewModel()
            {
                PatientId   = 1,
                FirstName   = "Andrew",
                LastName    = "Moshko",
                MiddleName  = "Victor",
                Age         = "18",
                Weight      = "83",
                Height      = "195",
                Email       = "*****@*****.**",
                PhoneNumber = "+380995135682",
                HomeNumber  = "-",
                Sex         = "man",
                Condition   = "test Patient"
            };

            // Create object Doctor
            Patient patient = model.ToEntity();

            this.ultraRepository.Setup(x => x.AddPatientAsync(patient))
            .ReturnsAsync(patient).Verifiable();

            // Run Code
            var result = await patientData.AddPatientAsync(model);

            // validate true result
            Assert.Equal(result.PatientId, model.PatientId);
            Assert.Equal(result.FirstName, model.FirstName);
            Assert.Equal(result.LastName, model.LastName);
            Assert.Equal(result.MiddleName, model.MiddleName);
            Assert.Equal(result.Age, model.Age);
            Assert.Equal(result.Weight, model.Weight);
            Assert.Equal(result.Height, model.Height);
            Assert.Equal(result.Email, model.Email);
            Assert.Equal(result.PhoneNumber, model.PhoneNumber);
            Assert.Equal(result.HomeNumber, model.HomeNumber);
            Assert.Equal(result.Sex, model.Sex);
            Assert.Equal(result.Condition, model.Condition);
        }