コード例 #1
0
        public async Task batch_get_next_for_read_model_all_events()
        {
            var entity = Guid.NewGuid();
            await _store.Append(Setup.UnversionedCommit(guid: entity));

            await _store.Append(Setup.UnversionedCommit(guid: entity));

            await _store.Append(Setup.UnversionedCommit("1"));

            var rm = new ReadModelGenerationConfig("test");

            var rez = _store.GetNextBatch(rm, 0);

            rez.IsEmpty.Should().BeFalse();
            var first = rez.GetNext().Value;

            first.EntityId.Should().Be(entity);
            first.TenantId.Should().Be("_");
            first.Version.Should().Be(1);

            var second = rez.GetNext().Value;

            second.EntityId.Should().Be(entity);
            second.TenantId.Should().Be("_");
            second.Version.Should().Be(2);

            var third = rez.GetNext().Value;

            third.EntityId.Should().NotBe(entity);
            third.TenantId.Should().Be("1");
            third.Version.Should().Be(1);

            rez.GetNext().IsEmpty.Should().BeTrue();
        }
コード例 #2
0
        void SetupCommits()
        {
            _storage.StartOrContinue("test").Returns(new ProcessedCommitsCount(0));

            _storage.GetNextBatch(Arg.Any <ReadModelGenerationConfig>(), 2)
            .Returns(new CommittedEvents(new Commit[0]));
            _storage.GetNextBatch(Arg.Any <ReadModelGenerationConfig>(), 0)
            .Returns(Setup.CommittedEvents <Event1, Event2>(2));
        }