Exemple #1
0
        public void VersionIsSetToPreviouslyGeneratedEvents()
        {
            const long expectedVersion = 313;

            var domainEvent1 = new TestDomainEvent(Guid.NewGuid(), 1);
            var domainEvent2 = new TestDomainEvent(Guid.NewGuid(), 2);

            sut.ApplyEvent(domainEvent2);
            sut.ApplyEvent(domainEvent1);

            sut.SetVersion(expectedVersion);

            Assert.AreEqual(expectedVersion, domainEvent1.EntityVersion);
            Assert.AreEqual(expectedVersion, domainEvent2.EntityVersion);
        }