示例#1
0
        protected async Task Given_No_Snapshots_For_A_Stream_When_Checking_A_Snapshot_Exists_Then_False_Is_Returned(IEventStoreProvider eventStoreProvider)
        {
            // Arrange
            string eventStreamId = Guid.NewGuid().ToEventStreamIdFormattedString();

            // Act
            bool snapshotExists = await eventStoreProvider.CheckSnapshotExistsAsync <TestAggregateSnapshot>(eventStreamId).ConfigureAwait(false);

            // Assert
            Assert.False(snapshotExists);
        }
示例#2
0
        protected async Task Given_A_Snapshot_Of_Different_Type_Exists_When_Checking_A_Snapshot_Then_False_Is_Returned(IEventStoreProvider eventStoreProvider)
        {
            // Arrange
            string    eventStreamId    = Guid.NewGuid().ToEventStreamIdFormattedString();
            string    snapshotStreamId = string.Format(CultureInfo.InvariantCulture, "{0}-snapshot", eventStreamId);
            Guid      snapshotId       = Guid.NewGuid();
            const int streamRevision   = 3;

            // Act
            eventStoreProvider.AppendEvents(eventStreamId, new object(), new object(), new object());
            await eventStoreProvider.CommitEventsAsync(eventStreamId, ExpectedStreamRevision.New).ConfigureAwait(false);

            EventStoreSnapshot eventStoreSnapshotToBeWritten = new EventStoreSnapshot(snapshotId, streamRevision, new object());
            await eventStoreProvider.AddSnapshotAsync(eventStreamId, snapshotStreamId, eventStoreSnapshotToBeWritten).ConfigureAwait(false);

            bool snapshotExists = await eventStoreProvider.CheckSnapshotExistsAsync <TestAggregateSnapshot>(snapshotStreamId).ConfigureAwait(false);

            // Assert
            Assert.False(snapshotExists);
        }