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); } }
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); } }
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>(); } }
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>(); } }
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>(); } }
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>(); } }