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); }
public async Task fetch_all_projections() { var operation1 = new InsertProjectionProgress(theStore.Events, new EventRange("five", 12)); var operation2 = new InsertProjectionProgress(theStore.Events, new EventRange("six", 25)); theSession.QueueOperation(operation1); theSession.QueueOperation(operation2); await theSession.SaveChangesAsync(); var progressions = await theStore.Events.AllProjectionProgress(); progressions.Any(x => x.ProjectionOrShardName == "five").ShouldBeTrue(); progressions.Any(x => x.ProjectionOrShardName == "six").ShouldBeTrue(); }
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); }
public async Task insert_progression() { var operation1 = new InsertProjectionProgress(theStore.Events, new EventRange("one", 12)); var operation2 = new InsertProjectionProgress(theStore.Events, new EventRange("two", 25)); theSession.QueueOperation(operation1); theSession.QueueOperation(operation2); await theSession.SaveChangesAsync(); var progress1 = await theStore.Events.ProjectionProgressFor("one"); progress1.ShouldBe(12); var progress2 = await theStore.Events.ProjectionProgressFor("two"); progress2.ShouldBe(25); }
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); }