public void RaiseEvent_WhenInvoked_MustAddEventToUncommitedChangesCollection()
        {
            // Arrange
            var @event  = new TestEvent1();
            var subject = new TestAggregate();

            // Act
            subject.InvokeRaiseEvent(@event);

            // Assert
            Assert.That(subject.GetUncommitedChanges(), Is.EqualTo(new [] { @event }));
        }
예제 #2
0
        public void MarkAllChangesAsCommited_WhenInvoked_MustClearUncommitedCollection()
        {
            // Arrange
            var subject = new TestAggregate();

            subject.InvokeRaiseEvent(new TestEvent1());

            // Act
            subject.MarkAllChangesAsCommited();

            // Assert
            Assert.That(subject.GetUncommitedChanges(), Is.Empty);
        }
        public void LoadFromHistory_WhenInvoked_MustNotAddEventsToUnpublishedEventsCollection()
        {
            // Arrange
            var testEvent1 = new TestEvent1();
            var testEvent2 = new TestEvent2();
            var events     = new IEvent[] { testEvent1, testEvent2 };
            var subject    = new TestAggregate();

            // Act
            subject.LoadFromHistory(events);

            // Assert
            Assert.That(subject.GetUncommitedChanges(), Is.Empty);
        }