Exemple #1
0
        public void CreatePatientContact_NullPatient_ThrowsArgumentException()
        {
            var patientContactRepository = new Mock <IPatientContactRepository> ();
            var patientContactFactory    = new PatientContactFactory(
                patientContactRepository.Object);

            patientContactFactory.CreatePatientContact(null, "Fred", "Smith");
        }
Exemple #2
0
        public void CreatePatientContact_NullLastName_ThrowsArgumentException()
        {
            var patientContactRepository = new Mock <IPatientContactRepository> ();
            var patientContactFactory    = new PatientContactFactory(
                patientContactRepository.Object);

            var patient = new Mock <Patient> ();

            patientContactFactory.CreatePatientContact(patient.Object, "Fred", null);
        }
Exemple #3
0
        public void CreatePatientContact_GivenValidArguments_CreatesContact()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var patientContactRepository = new Mock <IPatientContactRepository> ();
                var patientContactFactory    = new PatientContactFactory(patientContactRepository.Object);

                var patient = new Mock <Patient> ();

                PatientContact patientContact = patientContactFactory.CreatePatientContact(patient.Object, "Fred", "Smith");

                Assert.IsNotNull(patientContact);
            }
        }
Exemple #4
0
        public void CreatePatientContact_GivenValidArguments_ContactIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var patientContactRepository = new Mock <IPatientContactRepository>();
                var patientContactFactory    = new PatientContactFactory(
                    patientContactRepository.Object);

                var patient = new Mock <Patient>();

                PatientContact patientContact = patientContactFactory.CreatePatientContact(
                    patient.Object, "Fred", "Smith");

                patientContact.ReviseNote("some note");
            }
        }
Exemple #5
0
        public void CreatePatientContact_GivenValidArguments_ContactIsPersistent()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                bool isPersistent = false;

                var patientContactRepository = new Mock <IPatientContactRepository> ();
                patientContactRepository.Setup(p => p.MakePersistent(It.IsAny <PatientContact> ())).Callback(() => isPersistent = true);
                var patientContactFactory = new PatientContactFactory(patientContactRepository.Object);

                var patient = new Mock <Patient> ();

                patientContactFactory.CreatePatientContact(patient.Object, "Fred", "Smith");

                Assert.IsTrue(isPersistent);
            }
        }