Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static Task DeleteAsync(
     this IPersistence persistence,
     string partitionId
     )
 {
     return(persistence.DeleteAsync(partitionId, 0, long.MaxValue, CancellationToken.None));
 }
Exemplo n.º 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)
                          ));
 }
Exemplo n.º 5
0
 public Task Remove(
     string aggregateId,
     long fromVersionInclusive,
     long toVersionInclusive,
     CancellationToken cancellationToken)
 {
     return(_store.DeleteAsync(aggregateId, fromVersionInclusive, toVersionInclusive, cancellationToken));
 }
Exemplo n.º 6
0
        public async Task Should_invoke_persistence_on_clear()
        {
            await sut.ActivateAsync(id);

            await sut.PublicClearAsync();

            A.CallTo(() => persistence.DeleteAsync())
            .MustHaveHappened();
        }
Exemplo n.º 7
0
 public static Task DeleteAsync(
     this IPersistence store,
     string partitionId,
     long fromLowerIndexInclusive,
     long toUpperIndexInclusive
     )
 {
     return(store.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive, CancellationToken.None));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 16
0
        public Task ClearStateAsync()
        {
            State = new T();

            return(persistence.DeleteAsync());
        }
Exemplo n.º 17
0
        public Task ClearAsync()
        {
            Value = new T();

            return(persistence.DeleteAsync());
        }
Exemplo n.º 18
0
 public Task DeleteAsync(string partitionId, long fromLowerIndexInclusive, long toUpperIndexInclusive,
                         CancellationToken cancellationToken)
 {
     return(_persistence.DeleteAsync(partitionId, fromLowerIndexInclusive, toUpperIndexInclusive,
                                     cancellationToken));
 }
Exemplo n.º 19
0
 public Task DeleteAsync(string snapshotPartitionId, long fromVersionInclusive, long toVersionInclusive, CancellationToken cancellationToken)
 {
     return(_store.DeleteAsync(snapshotPartitionId, fromVersionInclusive, toVersionInclusive, cancellationToken));
 }
Exemplo n.º 20
0
        public Task ClearAsync()
        {
            state = new State();

            return(persistence.DeleteAsync());
        }
Exemplo n.º 21
0
 public async Task DeleteEventsAsync(string actorName, long inclusiveToIndex)
 {
     await _events.DeleteAsync(actorName, 0, inclusiveToIndex).ConfigureAwait(false);
 }