示例#1
0
        public void TestEmptyPaths()
        {
            var manager = new LogParserManager();
            var model   = new LogParserModel();

            manager.FindFiles(model).GetAwaiter().GetResult();
            Assert.AreEqual(1, model.ResultDisplay.Count);
            Assert.AreEqual("Empty paths", model.ResultDisplay[0]);
        }
示例#2
0
        public void AssertFilesCount()
        {
            var manager = new LogParserManager();
            var model   = new LogParserModel();

            model.IncludeFileInfo = false;
            var dir = Directory.GetCurrentDirectory();

            model.Paths = $"{dir}\\Data";
            manager.FindFiles(model).GetAwaiter().GetResult();
            Assert.AreEqual(4, model.ResultDisplay.Count);
            Assert.AreEqual($"{model.Paths}\\example20190101.log", model.ResultDisplay[1]);
            Assert.AreEqual($"{model.Paths}\\example20200101.log", model.ResultDisplay[2]);
        }
示例#3
0
        public LogParserViewModel(LogParserManager manager)
        {
            _manager = manager;
            Model    = new LogParserModel();

            var cleanDisplay = ReactiveCommand.Create(() =>
            {
                Model.ResultDisplay = new List <string> {
                    string.Empty
                };
                Model.ElapsedTime = "Elapsed time: -/-";
            });

            Search    = ReactiveCommand.CreateFromTask(async() => { Model.CleanDisplay(); await _manager.Search(Model); });
            FindFiles = ReactiveCommand.CreateFromTask(async() => { Model.CleanDisplay(); await _manager.FindFiles(Model); });
            Cancel    = ReactiveCommand.Create(() => _manager.Cancel());
            Copy      = ReactiveCommand.CreateFromTask(() => _manager.CopyToClipboard(Model.ResultDisplaySelectedItem));
        }