public void PersistPatient()
        {
            // Arrange
            var client = new Client();
            var patient = new Patient(client);
            var patientRepository = Mock.Create<IPatientRepository>(Behavior.Strict);

            Mock.Arrange(() => patientRepository.CreateOrUpdate(patient)).OccursOnce();
            var service = new PatientRegistrationService(patientRepository);

            // Act
            service.RegisterPatient(patient);

            // Assert
            Mock.Assert(patientRepository);
        }
        public void RaiseNewPatientCreatedEvent()
        {
            // Arrange
            var client = new Client();
            var patient = new Patient(client);
            var patientRepository = Mock.Create<IPatientRepository>();

            Mock.Arrange(() => patientRepository.CreateOrUpdate(patient));
            var service = new PatientRegistrationService(patientRepository);
            Patient patientReturnedFromEvent = null;
            service.NewPatientCreated += (o, e) =>
            {
                patientReturnedFromEvent = e.Patient;
            };

            // Act
            service.RegisterPatient(patient);

            // Assert
            Assert.IsNotNull(patientReturnedFromEvent);
        }
 public MessageBusNotificationService(PatientRegistrationService patientRegistrationService,
     IMessageBus<NewPatientCreatedEvent> messageBus)
 {
     this._messageBus = messageBus;
     this._patientRegistrationService = patientRegistrationService;
 }
Ejemplo n.º 4
0
 public MessageBusNotificationService(PatientRegistrationService patientRegistrationService,
                                      IMessageBus <NewPatientCreatedEvent> messageBus)
 {
     this._messageBus = messageBus;
     this._patientRegistrationService = patientRegistrationService;
 }