public void When_Applying_Event_And_Clearing_Uncomitted()
        {
            var subject = new AggregateStub(Guid.NewGuid());

            var newEvent = new EventStubTypeC();
            subject.ApplyEventToAggregate(newEvent);
            subject.ClearUncomittedEvents();

            Assert.That(subject.GetUncomittedEvents(), Is.Empty);
        }
        public void When_Applying_A_New_Event()
        {
            var subject = new AggregateStub(Guid.NewGuid());
            var @event = new EventStubTypeA();

            subject.ApplyEventToAggregate(@event);

            var uncomittedEvents = subject.GetUncomittedEvents();
            Assert.IsTrue(subject.EventTypeAApplied);
            Assert.That(uncomittedEvents, Has.Count.EqualTo(1));
            Assert.That(uncomittedEvents.First(), Is.SameAs(@event));
        }
        public void When_Loading_From_Event_History_And_Applying_New_Event()
        {
            var subject = new AggregateStub(Guid.NewGuid());
            var history = new List<EventBaseV1> { new EventStubTypeA(), new EventStubTypeB() };

            subject.LoadFromHistory(history);
            var newEvent = new EventStubTypeC();
            subject.ApplyEventToAggregate(newEvent);

            var uncomittedEvents = subject.GetUncomittedEvents();

            Assert.That(uncomittedEvents, Has.Count.EqualTo(1));
            Assert.That(uncomittedEvents.First(), Is.SameAs(newEvent));
            Assert.That(subject.EventTypeAApplied, Is.True);
            Assert.That(subject.EventTypeBApplied, Is.True);
            Assert.That(subject.EventTypeCApplied, Is.True);
        }