Esempio n. 1
0
        public void If_test_mode_is_off_an_null_reference_exception_is_thrown_when_an_event_is_applied()
        {
            var entityId = Guid.NewGuid();
            var entity   = new MyEntity(entityId);

            entity.TurnTestModeOff();

            entity.Apply(new MyEntityCreatedEvent());
        }
Esempio n. 2
0
        public void HandlerIsCalledWhenHandlerIsProtectedAndEventIsApplied()
        {
            var domainEvent = new EntityProtectedHandlerThatMeetsConventionEvent();
            var entity = new MyEntity(new Guid());
            entity.TurnTestModeOn();

            entity.Apply(domainEvent);

            Assert.IsTrue(entity.OnEntityProtectedHandlerThatMeetsConventionCalled);
        }
Esempio n. 3
0
        public void EntityId_is_set_on_applied_events()
        {
            var entityId = Guid.NewGuid();
            var entity = new MyEntity(entityId);
            entity.TurnTestModeOn();

            entity.Apply(new MyEntityCreatedEvent());

            Assert.AreEqual(entity.UncommittedEvents[0].EntityId, entityId);
        }
Esempio n. 4
0
        public void HandlerIsCalledWhenHandlerIsProtectedAndEventIsApplied()
        {
            var domainEvent = new EntityProtectedHandlerThatMeetsConventionEvent();
            var entity      = new MyEntity(new Guid());

            entity.TurnTestModeOn();

            entity.Apply(domainEvent);

            Assert.IsTrue(entity.OnEntityProtectedHandlerThatMeetsConventionCalled);
        }
Esempio n. 5
0
        public void EntityId_is_set_on_applied_events()
        {
            var entityId = Guid.NewGuid();
            var entity   = new MyEntity(entityId);

            entity.TurnTestModeOn();

            entity.Apply(new MyEntityCreatedEvent());

            Assert.AreEqual(entity.UncommittedEvents[0].EntityId, entityId);
        }
Esempio n. 6
0
        public void When_an_event_is_applied_to_the_entity_the_event_is_applied_to_the_aggregate_root()
        {
            var entityId = Guid.NewGuid();
            var entity   = new MyEntity(entityId);

            entity.AggregateRoot = new MyAggregateRoot();
            entity.TurnTestModeOn();

            entity.Apply(new MyEntityCreatedEvent());

            Assert.AreEqual(entity.UncommittedEvents[0].EntityId, entityId);
        }
Esempio n. 7
0
        public void When_an_event_is_applied_to_the_entity_the_event_is_added_to_the_uncommittedevents()
        {
            var entityId = Guid.NewGuid();
            var entity   = new MyEntity(entityId);

            entity.AggregateRoot = new MyAggregateRoot();
            entity.TurnTestModeOn();

            var entityCreatedEvent = new MyEntityCreatedEvent();

            entity.Apply(entityCreatedEvent);

            Assert.AreSame(entity.UncommittedEvents[0], entityCreatedEvent);
        }
Esempio n. 8
0
        public void If_test_mode_is_off_an_null_reference_exception_is_thrown_when_an_event_is_applied()
        {
            var entityId = Guid.NewGuid();
            var entity = new MyEntity(entityId);
            entity.TurnTestModeOff();

            entity.Apply(new MyEntityCreatedEvent());
        }
Esempio n. 9
0
        public void When_an_event_is_applied_to_the_entity_the_event_is_applied_to_the_aggregate_root()
        {
            var entityId = Guid.NewGuid();
            var entity = new MyEntity(entityId);
            entity.AggregateRoot = new MyAggregateRoot();
            entity.TurnTestModeOn();

            entity.Apply(new MyEntityCreatedEvent());

            Assert.AreEqual(entity.UncommittedEvents[0].EntityId, entityId);
        }
Esempio n. 10
0
        public void When_an_event_is_applied_to_the_entity_the_event_is_added_to_the_uncommittedevents()
        {
            var entityId = Guid.NewGuid();
            var entity = new MyEntity(entityId);
            entity.AggregateRoot = new MyAggregateRoot();
            entity.TurnTestModeOn();

            var entityCreatedEvent = new MyEntityCreatedEvent();

            entity.Apply(entityCreatedEvent);

            Assert.AreSame(entity.UncommittedEvents[0], entityCreatedEvent);
        }