コード例 #1
0
 public void Public_event_handlers_should_be_mapped()
 {
     using (var work = NcqrsEnvironment.Get<IUnitOfWorkFactory>().CreateUnitOfWork())
     {
         var target = new TheAggregateRoot();
         target.ApplyEvent(new EventForPublicMethod());
         target.OnEventForPublicMethodInvokedCount.Should().Be(1);
     }
 }
コード例 #2
0
 public void Public_event_handlers_should_be_mapped()
 {
     using (var work = NcqrsEnvironment.Get <IUnitOfWorkFactory>().CreateUnitOfWork(Guid.NewGuid()))
     {
         var target = new TheAggregateRoot();
         target.ApplyEvent(new EventForPublicMethod());
         target.OnEventForPublicMethodInvokedCount.Should().Be(1);
     }
 }
コード例 #3
0
        public void Method_with_a_wrong_method_name_should_not_be_mapped()
        {
            using (var work = NcqrsEnvironment.Get<IUnitOfWorkFactory>().CreateUnitOfWork())
            {
                var target = new TheAggregateRoot();

                Action act = () => target.ApplyEvent(new EventForMethodWithWrongMethodName());

                act.ShouldThrow<EventNotHandledException>();
            }
        }
コード例 #4
0
        public void Methods_marked_as_no_event_handler_should_not_be_mapped()
        {
            using (var work = NcqrsEnvironment.Get<IUnitOfWorkFactory>().CreateUnitOfWork())
            {
                var target = new TheAggregateRoot();

                Action act = () => target.ApplyEvent(new EventForNoEventHandlerMethod());

                act.ShouldThrow<EventNotHandledException>();
            }
        }
コード例 #5
0
        public void Methods_marked_as_no_event_handler_should_not_be_mapped()
        {
            using (var work = NcqrsEnvironment.Get <IUnitOfWorkFactory>().CreateUnitOfWork(Guid.NewGuid()))
            {
                var target = new TheAggregateRoot();

                Action act = () => target.ApplyEvent(new EventForNoEventHandlerMethod());

                act.ShouldThrow <EventNotHandledException>();
            }
        }
コード例 #6
0
        public void Method_with_a_wrong_method_name_should_not_be_mapped()
        {
            using (var work = NcqrsEnvironment.Get <IUnitOfWorkFactory>().CreateUnitOfWork(Guid.NewGuid()))
            {
                var target = new TheAggregateRoot();

                Action act = () => target.ApplyEvent(new EventForMethodWithWrongMethodName());

                act.ShouldThrow <EventNotHandledException>();
            }
        }