Ejemplo n.º 1
0
        public void Then_nothing_happened()
        {
            var aggregate = new TestFutureEventsAggregate(Guid.NewGuid().ToString());
            var testValue = "value D";

            aggregate.ScheduleInFuture(DateTime.Now.AddSeconds(400), testValue);

            aggregate.ClearUncommitedEvents();

            aggregate.CancelFutureEvents("will not be found in any future event");
            //No_events_were_produced()
            Assert.Empty(aggregate.GetEvents <DomainEvent>());
        }
Ejemplo n.º 2
0
        public void When_scheduling_future_event()
        {
            var aggregate = new TestFutureEventsAggregate(Guid.NewGuid().ToString());

            aggregate.ScheduleInFuture(DateTime.Now.AddSeconds(400), "value D");
            aggregate.ClearUncommitedEvents();

            //Then_raising_event_with_wrong_id_throws_an_error()
            Assert.Throws <ScheduledEventNotFoundException>(() => aggregate.RaiseScheduledEvent(Guid.NewGuid()
                                                                                                .ToString(),
                                                                                                Guid.NewGuid()
                                                                                                .ToString()));

            //Then_raising_event_with_wrong_id_does_not_produce_new_events()
            try
            {
                aggregate.RaiseScheduledEvent(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
            }
            catch
            {
                //intentionally left empty
            }
            Assert.Empty(aggregate.GetEvents());
        }