Example #1
0
        public async Task Bug_2201_update_successfully_but_have_deletion_next()
        {
            var target = Target.Random();

            theSession.Store(target);
            await theSession.SaveChangesAsync();

            var insertProjectionProgress = new InsertProjectionProgress(theStore.Events,
                                                                        new EventRange(new ShardName("three"), 12));


            theSession.QueueOperation(insertProjectionProgress);

            await theSession.SaveChangesAsync();

            var updateProjectionProgress =
                new UpdateProjectionProgress(theStore.Events, new EventRange(new ShardName("three"), 12, 50));

            theSession.QueueOperation(updateProjectionProgress);
            theSession.Delete(target);
            await theSession.SaveChangesAsync();

            var progress = await theStore.Advanced.ProjectionProgressFor(new ShardName("three"));

            progress.ShouldBe(50);
        }
Example #2
0
        public async Task update_happy_path()
        {
            var insertProjectionProgress = new InsertProjectionProgress(theStore.Events,
                                                                        new EventRange("three", 12));

            theSession.QueueOperation(insertProjectionProgress);
            await theSession.SaveChangesAsync();

            var updateProjectionProgress =
                new UpdateProjectionProgress(theStore.Events, new EventRange("three", 12, 50));

            theSession.QueueOperation(updateProjectionProgress);
            await theSession.SaveChangesAsync();

            var progress = await theStore.Events.ProjectionProgressFor("three");

            progress.ShouldBe(50);
        }
Example #3
0
        public async Task update_sad_path()
        {
            var insertProjectionProgress = new InsertProjectionProgress(theStore.Events,
                                                                        new EventRange("four", 12));

            theSession.QueueOperation(insertProjectionProgress);
            await theSession.SaveChangesAsync();

            var updateProjectionProgress = new UpdateProjectionProgress(theStore.Events, new EventRange("four", 5, 50));

            var ex = await Should.ThrowAsync <ProgressionProgressOutOfOrderException>(async() =>
            {
                theSession.QueueOperation(updateProjectionProgress);
                await theSession.SaveChangesAsync();
            });

            ex.Message.ShouldContain("four", StringComparisonOption.Default);

            // Just verifying that the real progress didn't change
            var progress = await theStore.Events.ProjectionProgressFor("four");

            progress.ShouldBe(12);
        }