public void VersionOfAggregateShouldBeInSyncWithNonSavedAppliedEvents() { var guid = Guid.NewGuid(); var aggregate = new TestSnapshotAggregate(guid, "Test Aggregate 1"); aggregate.ChangeName("New test Aggregate Version 1"); aggregate.ChangeName("New test Aggregate Version 2"); aggregate.ChangeName("New test Aggregate Version 3"); aggregate.ChangeName("New test Aggregate Version 4"); aggregate.ChangeName("New test Aggregate Version 5"); aggregate.ChangeName("New test Aggregate Version 6"); aggregate.ChangeName("New test Aggregate Version 7"); aggregate.GetSnapshot().Version.Should().Be(7); }
public void SnapshotProcessorShouldNotCreateSnapshotBeforeThresholdIsReached() { EventBus eventBus; EventStore eventStore; SnapshotStore snapshotStore; SnapshotProcessor snapshotProcessor; InMemorySnapshotStore memorySnapshotStore; var repository = EnvironmentMock.CreateEnvironment <TestSnapshotAggregate>(out eventBus, out eventStore, out snapshotStore, out snapshotProcessor, out memorySnapshotStore, 3); var guid = Guid.NewGuid(); var aggregate = new TestSnapshotAggregate(guid, "Test Snapshot Aggregate v0"); aggregate.ChangeName("Test Snapshot Aggregate v1"); repository.Save(aggregate, -1); memorySnapshotStore.Find(guid).Should().BeEmpty(); }