From 59a1700b8060f0ebd2a54057155d53a5da0f8a69 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 12 Sep 2024 10:51:58 -1000 Subject: [PATCH] introduce test to ensure that changes can still be written after an application restart --- src/SIL.Harmony.Tests/DataModelSimpleChanges.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/SIL.Harmony.Tests/DataModelSimpleChanges.cs b/src/SIL.Harmony.Tests/DataModelSimpleChanges.cs index a7af943..f909da6 100644 --- a/src/SIL.Harmony.Tests/DataModelSimpleChanges.cs +++ b/src/SIL.Harmony.Tests/DataModelSimpleChanges.cs @@ -33,6 +33,17 @@ public async Task CanUpdateTheNoteField() word.Note.Should().Be("a word note"); } + [Fact] + public async Task CanUpdateAWordAfterRestarting() + { + await WriteNextChange(SetWord(_entity1Id, "test-value")); + var instance2 = ForkDatabase();//creates new services, but copies database. Simulates restarting the application + await instance2.WriteNextChange(new SetWordNoteChange(_entity1Id, "a word note")); + var word = await instance2.DataModel.GetLatest(_entity1Id); + word!.Text.Should().Be("test-value"); + word.Note.Should().Be("a word note"); + } + [Fact] public async Task WritingA2ndChangeDoesNotEffectTheFirstSnapshot() {