public async Task Verify_aggregation_call()
        {
            ProjectionStatusLoader sut = new ProjectionStatusLoader(Database, Database, 5);

            SampleAggregateId identity1 = new SampleAggregateId(1);
            var aggregate = await Repository.GetByIdAsync <SampleAggregate>(identity1).ConfigureAwait(false);

            aggregate.Create();
            await Repository.SaveAsync(aggregate, Guid.NewGuid().ToString(), h => { }).ConfigureAwait(false);

            SampleAggregateId identity2 = new SampleAggregateId(2);

            aggregate = await Repository.GetByIdAsync <SampleAggregate>(identity2).ConfigureAwait(false);

            aggregate.Create();
            await Repository.SaveAsync(aggregate, Guid.NewGuid().ToString(), h => { }).ConfigureAwait(false);

            await Engine.UpdateAndWaitAsync().ConfigureAwait(false);

            var result = sut.GetSlotMetrics();

            Assert.That(result.Count(), Is.EqualTo(2));
            Assert.That(result.ElementAt(0).CommitBehind, Is.EqualTo(0));
            Assert.That(result.ElementAt(0).CommitBehind, Is.EqualTo(0));
        }
Beispiel #2
0
        public async void Verify_aggregation_call()
        {
            ProjectionStatusLoader sut = new ProjectionStatusLoader(Database, Database, 5);

            var aggregate = TestAggregateFactory.Create <SampleAggregate, SampleAggregate.State>(new SampleAggregateId(1));

            aggregate.Create();
            Repository.Save(aggregate, Guid.NewGuid(), h => { });

            aggregate = TestAggregateFactory.Create <SampleAggregate, SampleAggregate.State>(new SampleAggregateId(2));
            aggregate.Create();
            Repository.Save(aggregate, Guid.NewGuid(), h => { });

            var stream     = _eventStore.Advanced.GetFrom(0);
            var lastCommit = stream.Last();
            await Engine.UpdateAndWait();

            var result = sut.GetSlotMetrics();

            Assert.That(result.Count(), Is.EqualTo(2));
            Assert.That(result.ElementAt(0).CommitBehind, Is.EqualTo(0));
            Assert.That(result.ElementAt(0).CommitBehind, Is.EqualTo(0));
        }