public void ShouldApplySubmittedEvent()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                var events = new List <IDomainEvent>();
                CommitEvent.RegisterAll(events.Add);

                // Exercise
                Guid defGuid     = CombGuid.NewCombGuid();
                Guid patientGuid = CombGuid.NewCombGuid();
                var  source      = new AssessmentInstance(defGuid, patientGuid, assessmentName);
                source.Submit();

                // Verify
                Assert.AreEqual(2, events.Count);
                var submittedEvent = events[1];
                Assert.IsNotNull(submittedEvent);
                Assert.AreEqual(typeof(AssessmentSubmittedEvent), submittedEvent.GetType());
                Assert.AreEqual((submittedEvent as AssessmentSubmittedEvent).Submit, true);
                Assert.AreEqual(2, source.Version);
            }
        }
Example #2
0
        public void AssessmentSubmittedEventIsRaisedWhenSubmit()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                //Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                bool eventRaised = false;
                DomainEvent.Register <AssessmentSubmittedEvent>(s => eventRaised = true);

                // Exercise
                Guid defGuid     = CombGuid.NewCombGuid();
                Guid patientGuid = CombGuid.NewCombGuid();
                var  source      = new AssessmentInstance(defGuid, patientGuid, "testName");
                source.Submit();

                // Verify
                Assert.IsTrue(eventRaised);
            }
        }