| | |
| | | using Moli.Desktop.Configuration; |
| | | using Moli.Desktop.Diagnostics; |
| | | using Moli.Desktop.Host; |
| | | using Moli.Desktop.Layout; |
| | | using Moli.Desktop.Plugins; |
| | | |
| | | namespace Moli.Desktop.Tests.Configuration; |
| | | |
| | |
| | | Assert.True(File.Exists(Path.Combine(paths.ConfigDirectory, "appsettings.json.bak"))); |
| | | } |
| | | |
| | | [Fact] |
| | | public async Task SaveAndLoadLayoutAsync_UsesDisplayLayerJsonNames() |
| | | { |
| | | var (service, paths, _) = CreateService(); |
| | | |
| | | await service.SaveLayoutAsync(new LayoutDocument |
| | | { |
| | | Instances = |
| | | [ |
| | | new WidgetLayout |
| | | { |
| | | InstanceId = new WidgetInstanceId("widget-01"), |
| | | PluginId = new PluginId("sample.clock"), |
| | | MonitorId = new MonitorId("primary"), |
| | | Bounds = new RectD(0, 0, 320, 160), |
| | | DisplayLayer = DisplayLayer.AppTop |
| | | } |
| | | ] |
| | | }); |
| | | |
| | | var json = await File.ReadAllTextAsync(Path.Combine(paths.ConfigDirectory, "layout.json")); |
| | | Assert.Contains("\"displayLayer\": \"app-top\"", json); |
| | | |
| | | var loaded = await service.LoadLayoutAsync(); |
| | | Assert.Equal(DisplayLayer.AppTop, Assert.Single(loaded.Instances).DisplayLayer); |
| | | } |
| | | |
| | | private static (JsonConfigurationService Service, DesktopPaths Paths, DiagnosticsService Diagnostics) CreateService() |
| | | { |
| | | var root = Path.Combine(Path.GetTempPath(), "Moli.Desktop.Tests", Guid.NewGuid().ToString("N")); |