Exemplo n.º 1
0
        public async Task DeletePresetAsyncTest_正常_CurrentPresetでない()
        {
            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",
            });
            settingService.UserSettings.PresetInfos.Add(new PresetInfo()
            {
                Id       = "300",
                Name     = "baz",
                FileName = "baz_300.json",
            });

            await target.DeletePresetAsync("200");

            CollectionAssert.AreEqual(new[] { nameof(ConfigJsonService.IsBusy), nameof(ConfigJsonService.IsBusy) }, notifiedProperies);
            Assert.IsFalse(target.IsBusy);
            Assert.AreEqual("300", target.CurrentPreset.Id);
            Assert.AreEqual(Path.Combine(appSettings.AppDataPath, "bar_200.json"), fileService.DeletePath);
            CollectionAssert.AreEqual(new[] { "100", "300" }, settingService.UserSettings.PresetInfos.Select(e => e.Id).ToArray());
        }
Exemplo n.º 2
0
 /// <summary>
 /// プリセットの削除
 /// </summary>
 public async void Delete()
 {
     if (CurrentPreset == null)
     {
         return;
     }
     await ConfigJsonService.DeletePresetAsync(CurrentPreset.Id);
 }