Пример #1
0
        public async Task should_skip_holes()
        {
            var sequence = await CreateStream("sequence_1").ConfigureAwait(false);

            await _persistence.DeleteAsync(sequence.Id, 2, 9).ConfigureAwait(false);

            var result = await sequence
                         .Fold()
                         .ToIndex(10)
                         .WithCache(_snapshots)
                         .RunAsync <Sum>().ConfigureAwait(false);

            Assert.Equal(11, result.Total);
        }
Пример #2
0
 public static Task DeleteAsync(
     this IPersistence persistence,
     string partitionId
     )
 {
     return(persistence.DeleteAsync(partitionId, 0, long.MaxValue, CancellationToken.None));
 }
Пример #3
0
 public static Task DeleteAsync(
     this IPersistence persistence,
     string partitionId,
     long fromLowerIndexInclusive
     )
 {
     return(persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, long.MaxValue, CancellationToken.None));
 }
 public Task DeleteAsync(string partitionId, long fromLowerIndexInclusive, long toUpperIndexInclusive,
                         CancellationToken cancellationToken)
 {
     return(Track.Profile(Timers.Delete, () =>
                          _persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive,
                                                   cancellationToken)
                          ));
 }
Пример #5
0
 public Task Remove(
     string aggregateId,
     long fromVersionInclusive,
     long toVersionInclusive,
     CancellationToken cancellationToken)
 {
     return(_store.DeleteAsync(aggregateId, fromVersionInclusive, toVersionInclusive, cancellationToken));
 }
Пример #6
0
        public async Task Should_invoke_persistence_on_clear()
        {
            await sut.ActivateAsync(id);

            await sut.PublicClearAsync();

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();
        }
Пример #7
0
 public static Task DeleteAsync(
     this IPersistence store,
     string partitionId,
     long fromLowerIndexInclusive,
     long toUpperIndexInclusive
     )
 {
     return(store.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive, CancellationToken.None));
 }
Пример #8
0
 public async Task DeleteAsync(
     string partitionId,
     long fromLowerIndexInclusive,
     long toUpperIndexInclusive,
     CancellationToken cancellationToken)
 {
     await DeleteCounter.CaptureAsync(() =>
                                      _store.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive, cancellationToken)
                                      ).ConfigureAwait(false);
 }
Пример #9
0
        public async Task DeleteAsync(
            string partitionId,
            long fromLowerIndexInclusive,
            long toUpperIndexInclusive,
            CancellationToken cancellationToken)
        {
            _logger.LogDebug("Start DeleteAsync({partitionId}, {from}, {to})", partitionId, fromLowerIndexInclusive, toUpperIndexInclusive);
            await _persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive, cancellationToken).ConfigureAwait(false);

            _logger.LogDebug("End DeleteAsync({partitionId}, {from}, {to})", partitionId, fromLowerIndexInclusive, toUpperIndexInclusive);
        }
Пример #10
0
        public async Task delete_should_be_recorded()
        {
            await _store.DeleteAsync("empty").ConfigureAwait(false);

            Assert.Equal(0, _profile.PersistCounter.Calls);
            Assert.Equal(1, _profile.DeleteCounter.Calls);
            Assert.Equal(0, _profile.StoreScanCounter.Calls);
            Assert.Equal(0, _profile.ReadForwardCounter.Calls);
            Assert.Equal(0, _profile.ReadBackwardCounter.Calls);
            Assert.Equal(0, _profile.ReadSingleBackwardCounter.Calls);
        }
Пример #11
0
        public async void delete_should_be_recorded()
        {
            await _store.DeleteAsync("empty");

            Assert.Equal(0, _profile.PersistCounter.Calls);
            Assert.Equal(1, _profile.DeleteCounter.Calls);
            Assert.Equal(0, _profile.StoreScanCounter.Calls);
            Assert.Equal(0, _profile.ReadForwardCounter.Calls);
            Assert.Equal(0, _profile.ReadBackwardCounter.Calls);
            Assert.Equal(0, _profile.PeekCounter.Calls);
        }
Пример #12
0
        public async Task Should_delete_and_reset_state_when_cleaning()
        {
            await sut.AddSchemaAsync(schemaId1, schemaName1);

            await sut.ClearAsync();

            var id = await sut.GetSchemaIdAsync(schemaName1);

            Assert.Equal(id, Guid.Empty);

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();
        }
        public async Task Should_delete_and_reset_state_when_cleaning()
        {
            await sut.AddRuleAsync(ruleId1);

            await sut.AddRuleAsync(ruleId2);

            await sut.ClearAsync();

            var ids = await sut.GetRuleIdsAsync();

            Assert.Empty(ids);

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();
        }
Пример #14
0
        public async Task Should_delete_and_reset_state_when_cleaning()
        {
            await sut.NormalizeTagsAsync(HashSet.Of("name1", "name2"), null);

            await sut.NormalizeTagsAsync(HashSet.Of("name2", "name3"), null);

            await sut.ClearAsync();

            var allTags = await sut.GetTagsAsync();

            Assert.Empty(allTags);

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();
        }
Пример #15
0
        public async Task Should_write_events_to_delete_stream_on_delete()
        {
            SetupCreated(4);
            SetupDeleted();

            var deleteStream = A.Fake <IPersistence>();

            A.CallTo(() => store.WithEventSourcing(typeof(MyDomainObject), DomainId.Combine(id, DomainId.Create("deleted")), null))
            .Returns(deleteStream);

            await sut.ExecuteAsync(new DeletePermanent());

            AssertSnapshot(sut.Snapshot, 0, EtagVersion.Empty, false);

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();

            A.CallTo(() => persistence.WriteEventsAsync(A <IReadOnlyList <Envelope <IEvent> > > ._))
            .MustHaveHappenedOnceExactly();

            A.CallTo(() => deleteStream.WriteEventsAsync(A <IReadOnlyList <Envelope <IEvent> > > ._))
            .MustHaveHappened();
        }
Пример #16
0
        public Task ClearStateAsync()
        {
            State = new T();

            return(persistence.DeleteAsync());
        }
Пример #17
0
        public Task ClearAsync()
        {
            Value = new T();

            return(persistence.DeleteAsync());
        }
Пример #18
0
 public Task DeleteAsync(string partitionId, long fromLowerIndexInclusive, long toUpperIndexInclusive,
                         CancellationToken cancellationToken)
 {
     return(_persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive,
                                     cancellationToken));
 }
Пример #19
0
 public Task DeleteAsync(string snapshotPartitionId, long fromVersionInclusive, long toVersionInclusive, CancellationToken cancellationToken)
 {
     return(_store.DeleteAsync(snapshotPartitionId, fromVersionInclusive, toVersionInclusive, cancellationToken));
 }
Пример #20
0
        public Task ClearAsync()
        {
            state = new State();

            return(persistence.DeleteAsync());
        }
Пример #21
0
 public async Task DeleteEventsAsync(string actorName, long inclusiveToIndex)
 {
     await _events.DeleteAsync(actorName, 0, inclusiveToIndex).ConfigureAwait(false);
 }