예제 #1
0
        public async Task it_should_find_an_existing_courses_counter()
        {
            CoursesCounter         counter  = CoursesCounterMother.Random();
            CoursesCounterResponse response = CoursesCounterResponseMother.Create(counter.Total.Value);

            ShouldSearch(counter);

            Assert.Equal(response, await _finder.Find());
        }
예제 #2
0
        public async Task it_should_find_an_existing_courses_counter()
        {
            var counter = CoursesCounterMother.Random();
            var query   = new FindCoursesCounterQuery();

            var response = CoursesCounterResponseMother.Create(counter.Total.Value);

            ShouldSearch(counter);

            Assert.Equal(response, await _handler.Handle(query));
        }
        public void it_should_increment_an_existing_counter()
        {
            var domainEvent = CourseCreatedDomainEventMother.Random();

            var courseId           = CourseIdMother.Create(domainEvent.AggregateId);
            var existingCounter    = CoursesCounterMother.Random();
            var incrementedCounter = CoursesCounterMother.Incrementing(existingCounter, courseId);

            ShouldSearch(existingCounter);

            Subscriber.On(domainEvent);

            ShouldHaveSaved(incrementedCounter);
        }