public void CreatePatientContact_NullFirstName_ThrowsArgumentException() { var patientContactRepository = new Mock<IPatientContactRepository> (); var patientContactFactory = new PatientContactFactory ( patientContactRepository.Object ); var patient = new Mock<Patient> (); patientContactFactory.CreatePatientContact ( patient.Object, null, "Smith" ); }
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 ); } }
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"); } }
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 ); } }
public void DestroyPatientContact_GivenAPatientContact_ContactIsTransient() { bool isTransient = false; var patientContactRepository = new Mock<IPatientContactRepository> (); patientContactRepository .Setup ( p => p.MakeTransient ( It.IsAny<PatientContact> () ) ) .Callback ( () => isTransient = true ); var patientContactFactory = new PatientContactFactory ( patientContactRepository.Object ); var patient = new Mock<Patient> (); var patientContact = new Mock<PatientContact> (); patientContact.Setup ( p => p.Patient ).Returns ( patient.Object ); patientContactFactory.DestroyPatientContact ( patientContact.Object ); Assert.IsTrue ( isTransient ); }
public void DestroyPatientContact_GivenANullPatientContact_ThrowsArgumentException() { var patientContactRepository = new Mock<IPatientContactRepository> (); var patientContactFactory = new PatientContactFactory ( patientContactRepository.Object ); patientContactFactory.DestroyPatientContact ( null ); }
public void CreatePatientContact_NullPatient_ThrowsArgumentException() { var patientContactRepository = new Mock<IPatientContactRepository> (); var patientContactFactory = new PatientContactFactory ( patientContactRepository.Object ); patientContactFactory.CreatePatientContact ( null, "Fred", "Smith" ); }