public void All_existed_future_events_remain_the_same()
        {
            _aggregate.RaiseScheduledEvent(_futureEvent.Id);
            var occuredEvent = _aggregate.GetEvent <FutureEventOccuredEvent>();

            Assert.AreEqual(_futureEvent.Id, occuredEvent.FutureEventId);
        }
        public void Canceled_event_cannot_be_raised()
        {
            _aggregate.ClearEvents();
            Assert.Throws <ScheduledEventNotFoundException>(() => _aggregate.RaiseScheduledEvent(_futureEventA.Id));
            var anyEvents = _aggregate.GetEvents <DomainEvent>();

            CollectionAssert.IsEmpty(anyEvents);
        }
コード例 #3
0
        public void When_raising_future_event()
        {
            _testCommand = new ScheduleEventInFutureCommand(DateTime.Now, Guid.NewGuid(), "test value");

            _aggregate = new TestAggregate(_testCommand.AggregateId);
            _aggregate.ScheduleInFuture(_testCommand.RaiseTime, _testCommand.Value);

            _futureEventEnvelop = _aggregate.GetEvent <FutureEventScheduledEvent>();
            _aggregate.RaiseScheduledEvent(_futureEventEnvelop.Id);
            _producedEvent           = _aggregate.GetEvent <TestDomainEvent>();
            _futureEventOccuredEvent = _aggregate.GetEvent <FutureEventOccuredEvent>();
        }
 public void Then_raising_event_with_wrong_id_throws_an_error()
 {
     Assert.Throws <ScheduledEventNotFoundException>(() => _aggregate.RaiseScheduledEvent(Guid.NewGuid()));
 }