示例#1
0
        public void it_should_get_valid_fullname()
        {
            //Act
            var _patientDto = _patientRetriever.Retrieve(1);

            //Assert
            _patientDto.FullName.Should().Be("Nath1, John1 K1");
        }
示例#2
0
        public void GivenPatientWhenRegisteringThenPersistToDb()
        {
            HospitalManagementSystemContext HospitalManagementSystemContext = EntityFrameworkMock.Create <HospitalManagementSystemContext>();

            TypeFactory.RegisterInstance(HospitalManagementSystemContext);

            Patient patient = new Patient();

            patient.PersonId         = 1;
            patient.Person.Id        = 1;
            patient.Person.FirstName = "Vusi";
            patient.Person.Surname   = "Khoza";
            patient.Person.IdNumber  = "1234";

            IPatientRepository   patientRepository   = new PatientRepository();
            IPatientRegistration patientRegistration = new PatientRegistration(patientRepository);

            patientRegistration.Register(patient);

            IPatientRetriever patientRetriever = new PatientRetriever(patientRepository);

            patientRetriever.Retrieve(patient.Person.IdNumber);

            Assert.IsNotNull(patientRetriever.Patient);
            Assert.AreEqual(patient.Person.Id, patientRetriever.Patient.Person.Id);
            Assert.AreEqual(patient.Person.FirstName, patientRetriever.Patient.Person.FirstName);
            Assert.AreEqual(patient.Person.Surname, patientRetriever.Patient.Person.Surname);
        }
示例#3
0
        public void it_should_not_have_middle_initial()
        {
            //Act
            var _patientDto = _patientRetriever.Retrieve(5);

            //Assert
            _patientDto.FullName.Should().Be("Nath5, John5");
        }
示例#4
0
        public void it_should_throw_an_exception()
        {
            var logger            = Substitute.For <ILogger>();
            var patientRepository = Substitute.For <IPatientRepository>();

            //Arrange
            var patientRetriever = new PatientRetriever(logger, patientRepository);
            var patientDto       = patientRetriever.Retrieve(0);

            patientDto.Should().BeNull();
        }