Beispiel #1
0
        public async Task LoadPresetTest_正常()
        {
            appSettings.AppDataPath = @"C:\AppData";
            settingService.UserSettings.PresetInfos.Add(new PresetInfo()
            {
                Id       = "100",
                Name     = "foo",
                FileName = "foo_100.json",
            });
            settingService.UserSettings.PresetInfos.Add(new PresetInfo()
            {
                Id       = "200",
                Name     = "bar",
                FileName = "bar_200.json",
            });
            fileService.ConfigJson = new ConfigJson()
            {
                NgScoreThreshold = -999
            };

            await target.LoadPresetAsync("200");

            Assert.IsFalse(target.IsBusy);
            CollectionAssert.AreEqual(
                new[] { nameof(ConfigJsonService.IsBusy), nameof(ConfigJsonService.ConfigJson), nameof(ConfigJsonService.CurrentPreset), nameof(ConfigJsonService.IsBusy) },
                notifiedProperies);
            Assert.AreEqual(Path.Combine(appSettings.AppDataPath, "bar_200.json"), fileService.ReadAsyncPath);
            Assert.AreEqual(fileService.ConfigJson, target.ConfigJson);
            Assert.AreEqual("200", target.CurrentPreset.Id);
        }
Beispiel #2
0
        /// <summary>
        /// プリセットのロード
        /// </summary>
        public async void LoadPreset()
        {
            if (SelectedPreset == null)
            {
                return;
            }

            await ConfigJsonService.LoadPresetAsync(SelectedPreset.Id);

            SelectedPreset = null;
        }