示例#1
0
        public FilterVM(LineFilterType type, Action <FilterVM> removeFromUI)
        {
            this.type = type;
            switch (type)
            {
            case LineFilterType.MatchesRegex:
                _filterTypeDesc = "Match Regex: ";
                break;

            case LineFilterType.StartsWith:
                _filterTypeDesc = "Start with: ";
                break;
            }

            RemoveFilter = new DelegateCommand(_ =>
            {
                removed = true;
                removeFromUI(this);
            });
        }
        private void Success(LineFilterType filterType, string textToMatch, bool useRegex, bool caseSensitive)
        {
            FilterLinesProcessor processor = new FilterLinesProcessor();

            processor.SetParameter("FilterType", filterType);
            processor.SetParameter("TextToMatch", textToMatch);
            processor.SetParameter("UseRegex", useRegex);
            processor.SetParameter("CaseSensitive", caseSensitive);
            processor.SetParameter("LineEndings", LineEndings.MatchInput);
            processor.SetParameter("OutputEncoding", OutputEncodingType.MatchInput);
            processor.SetParameter("FileName", GetCurrentTestResultsFilePath("out.txt"));
            processor.SetParameter("OverwriteExistingFile", true);
            processor.SetParameter("MoveOriginalToRecycleBin", false);
            FileInfo file = GetTestFile("Lipsum.txt");

            processor.Init(RunInfo);
            ProcessingResult result = processor.Process(file, MatchResultType.Yes,
                                                        new string[0], new FileInfo[0], ProcessInput.OriginalFile, CancellationToken.None);

            Assert.AreEqual(ProcessingResultType.Success, result.Type);
            Assert.AreEqual(1, result.OutputFiles.Length);
            processor.Cleanup();
        }