public async Task PublishDomainEventFromRabbitMq() { CourseCreatedDomainEvent domainEvent = CourseCreatedDomainEventMother.Random(); await _bus.Publish(new List <DomainEvent>() { domainEvent }); await _consumer.Consume(); Eventually(() => Assert.True(_subscriber.HasBeenExecuted)); }
public void it_should_not_increment_an_already_incremented_course() { CourseCreatedDomainEvent domainEvent = CourseCreatedDomainEventMother.Random(); CourseId courseId = CourseIdMother.Create(domainEvent.AggregateId); CoursesCounter existingCounter = CoursesCounterMother.WithOne(courseId); ShouldSearch(existingCounter); this.Subscriber.On(domainEvent); }
public void PublishAndConsumeDomainEventFromMsSql() { var bus = GetService <MsSqlEventBus>(); var consumer = GetService <MsSqlDomainEventsConsumer>(); CourseCreatedDomainEvent domainEvent = CourseCreatedDomainEventMother.Random(); bus.Publish(new List <DomainEvent>() { domainEvent }); consumer.Consume(); }
public void it_should_increment_an_existing_counter() { CourseCreatedDomainEvent domainEvent = CourseCreatedDomainEventMother.Random(); CourseId courseId = CourseIdMother.Create(domainEvent.AggregateId); CoursesCounter existingCounter = CoursesCounterMother.Random(); CoursesCounter incrementedCounter = CoursesCounterMother.Incrementing(existingCounter, courseId); ShouldSearch(existingCounter); this.Subscriber.On(domainEvent); ShouldHaveSaved(incrementedCounter); }
public void it_should_initialize_a_new_counter() { CourseCreatedDomainEvent domainEvent = CourseCreatedDomainEventMother.Random(); CourseId courseId = CourseIdMother.Create(domainEvent.AggregateId); CoursesCounter newCounter = CoursesCounterMother.WithOne(courseId); ShouldSearch(); ShouldGenerateUuid(newCounter.Id.Value); this.Subscriber.On(domainEvent); this.ShouldHaveSaved(newCounter); }
public void Invoke(CourseCreatedDomainEvent domainEvent) { CourseId courseId = new CourseId(domainEvent.AggregateId); this.Incrementer.Invoke(courseId); }