namespace Mr.BrickAdventures.Progression.Tests; public class ProfileStoreTests { private static readonly LevelId Level = LevelId.Of("village_1"); [Fact] public void On_a_first_run_there_is_no_profile_yet_and_that_is_absent_not_corrupt() { var store = new InMemoryProfileStore(); Assert.Equal(LoadOutcome.Absent, store.Load().Outcome); } [Fact] public void A_saved_profile_loads_back_with_its_best_times() { var store = new InMemoryProfileStore(); var profile = Profile.Empty(); profile.RecordTime(Level, LevelTime.Of(31.25)); store.Save(profile); var result = store.Load(); Assert.Equal(LoadOutcome.Loaded, result.Outcome); Assert.Equal(LevelTime.Of(31.25), result.Value!.BestTimeFor(Level)); } [Fact] public void A_profile_that_cannot_be_read_is_corrupt_so_achievements_are_not_silently_wiped() { var store = new InMemoryProfileStore(); store.Save(Profile.Empty()); store.Corrupt(); Assert.Equal(LoadOutcome.Corrupt, store.Load().Outcome); } }