Ejemplo n.º 1
0
        public void HandlerIsCalledWhenHandlerIsProtectedAndEventIsApplied()
        {
            var domainEvent   = new AggregateRootProtectedHandlerThatMeetsConventionEvent();
            var aggregateRoot = new MyAggregateRoot();

            aggregateRoot.Apply(domainEvent);

            Assert.IsTrue(aggregateRoot.OnAggregateRootProtectedHandlerThatMeetsConventionCalled);
        }
Ejemplo n.º 2
0
        public void HandlerIsCalledWhenHandlerIsProtectedAndEventIsApplied()
        {
            var domainEvent = new AggregateRootProtectedHandlerThatMeetsConventionEvent();
            var aggregateRoot = new MyAggregateRoot();

            aggregateRoot.Apply(domainEvent);

            Assert.IsTrue(aggregateRoot.OnAggregateRootProtectedHandlerThatMeetsConventionCalled);
        }
Ejemplo n.º 3
0
        public void WhenEventModifierIsSetModificationsAreApplied()
        {
            // Arrange
            var fakeModification = new FakeModification
            {
                ModifyValueTo = "Yes we can"
            };
            var aggregateRoot = new MyAggregateRoot();
            var domainEvent   = new EventForModificationTestEvent();

            EventModifier.Modification = fakeModification;

            // Act
            aggregateRoot.Apply(domainEvent);

            // Assert
            Assert.AreEqual(domainEvent.ModifiedValue, fakeModification.ModifyValueTo);

            // Teardown
            EventModifier.Modification = null;
        }
Ejemplo n.º 4
0
        public void WhenEventModifierIsSetModificationsAreApplied()
        {
            // Arrange
            var fakeModification = new FakeModification
            {
                ModifyValueTo = "Yes we can"
            };
            var aggregateRoot = new MyAggregateRoot();
            var domainEvent = new EventForModificationTestEvent();

            EventModifier.Modification = fakeModification;

            // Act
            aggregateRoot.Apply(domainEvent);

            // Assert
            Assert.AreEqual(domainEvent.ModifiedValue, fakeModification.ModifyValueTo);

            // Teardown
            EventModifier.Modification = null;
        }