Exemplo n.º 1
0
        public async Task ImportJsonAsyncTest_正常()
        {
            fileService.ConfigJson = new ConfigJson()
            {
                NgScoreThreshold = -999
            };
            var path = @"C:\work\config.json";

            await target.ImportJsonAsync(path);

            Assert.IsFalse(target.IsBusy);
            CollectionAssert.AreEqual(
                new[] { nameof(ConfigJsonService.IsBusy), nameof(ConfigJsonService.ConfigJson), nameof(ConfigJsonService.CurrentPreset), nameof(ConfigJsonService.IsBusy) },
                notifiedProperies);
            Assert.AreEqual(path, fileService.ReadAsyncPath);
            Assert.AreEqual(fileService.ConfigJson, target.ConfigJson);
            Assert.IsNull(target.CurrentPreset);
            Assert.IsNull(errorEvent);
        }
Exemplo n.º 2
0
        /// <summary>
        /// JSONファイルのインポート
        /// </summary>
        private async void ImportJson()
        {
            var message = new OpeningFileSelectionMessage("ImportJsonFileDialog")
            {
                Title  = Resources.ImportJsonFileDialogTitle,
                Filter = Resources.FileDialogJsonFilter,
            };

            var result = Messenger.GetResponse(message);

            var path = result?.Response?.FirstOrDefault();

            if (!string.IsNullOrWhiteSpace(path))
            {
                await ConfigJsonService.ImportJsonAsync(path);
            }
        }