Fix test not waiting properly for background processing to complete

This commit is contained in:
Bartłomiej Dach 2024-07-16 14:01:33 +02:00
parent 6db135279f
commit 53b6f9e385
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -179,7 +179,9 @@ public void TestScoreUpgradeFailed(int scoreVersion)
});
});
AddStep("Run background processor", () => Add(new TestBackgroundDataStoreProcessor()));
TestBackgroundDataStoreProcessor processor = null!;
AddStep("Run background processor", () => Add(processor = new TestBackgroundDataStoreProcessor()));
AddUntilStep("Wait for completion", () => processor.Completed);
AddUntilStep("Score marked as failed", () => Realm.Run(r => r.Find<ScoreInfo>(scoreInfo.ID)!.BackgroundReprocessingFailed), () => Is.True);
AddAssert("Score version not upgraded", () => Realm.Run(r => r.Find<ScoreInfo>(scoreInfo.ID)!.TotalScoreVersion), () => Is.EqualTo(scoreVersion));