using System; using System.IO; using System.Threading.Tasks; using Xunit; namespace PostIt.Tests; public class SettingsLoadTests { /// /// On the dev machine, the user-level settings file /// (~/.config/PostIt/postit-settings.json) does not exist, so Load() /// must fall back to the embedded default resource shipped inside /// PostIt.dll. /// [Fact] public async Task Load_falls_back_to_embedded_resource_when_user_file_missing() { // Skip if a user-level file exists (CI / different dev machines). var userConfigPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PostIt", "postit-settings.json"); if (File.Exists(userConfigPath)) { return; // nothing to assert: user file wins. } var settings = new PostIt.Settings(); await settings.Load(); // The bundled postit-settings.json points at yavsc.pschneider.fr. Assert.False(string.IsNullOrWhiteSpace(settings.Authentication?.Authority)); Assert.Equal("postit", settings.Authentication.ClientId); } }