Save a profile without taking it for a save of eu07.ini

A profile went through the save of eu07.ini with another path: what the store
holds of the file took the changes the file never got, and the list of changes
was empty after it. A profile is now written as an export, from a copy. Like a
save, an export is not written from defaults when the settings could not be
read.
This commit is contained in:
maj00r
2026-11-03 21:51:53 +01:00
parent 2cfb4e4fec
commit c10d771f00
3 changed files with 26 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
using StarterNG.Application;
using StarterNG.Domain.Settings;
using StarterNG.Tests.Fakes;
@@ -564,11 +565,25 @@ public class SettingsStoreTests
var installation = WithHome(files);
installation.SettingsStore.Load();
installation.SettingsStore.SaveTo(profile);
Assert.False(installation.SettingsStore.ExportTo(profile));
Assert.False(files.FileExists(profile));
}
[Fact]
public void A_profile_written_leaves_what_the_users_file_still_lacks_to_be_saved()
{
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "uart COM3 57600 0.1\n"));
installation.SettingsStore.Load();
installation.SettingsStore.Settings.UartPort = "COM4";
Assert.True(installation.SettingsStore.ExportTo("/home/kolejarz/profile.ini"));
Assert.Contains(new IniChange("uart", "COM3 57600 0.1", "COM4 57600 0.1"),
installation.SettingsStore.Changes(installation.SettingsStore.Settings));
Assert.Contains("uart COM3 57600 0.1", installation.Files.ReadAllText(UserIni));
}
[Fact]
public void A_read_that_works_again_lets_the_settings_be_saved()
{