Esempio n. 1
0
        public void Skips_lines_wihtout_valid_time_before_colon()
        {
            var processor = new TestProcessor();
            var parser    = new OutputLogParser("some random text with colon: but without valid time", processor);

            parser.Parse();

            processor.Result.Should().Be(string.Empty);
        }
Esempio n. 2
0
        public void Skips_lines_without_colon()
        {
            var processor = new TestProcessor();
            var parser    = new OutputLogParser("some random text withotu colon", processor);

            parser.Parse();

            processor.Result.Should().Be(string.Empty);
        }
Esempio n. 3
0
        public void Can_provide_time_and_rest_of_the_line_to_processor()
        {
            var processor = new TestProcessor();
            var parser    = new OutputLogParser("4:21:21 PM: Skill Lumberjacking increased by 0.1 %, currently it is 88.6 %", processor);

            parser.Parse();

            processor.Result.Should().Be("04:21:21 - Skill Lumberjacking increased by 0.1 %, currently it is 88.6 %");
        }
Esempio n. 4
0
        public void Can_parse_multiple_lines_with_dos_eol()
        {
            var processor = new TestProcessor();
            var parser    = new OutputLogParser("4:21:21 PM: x\r\n4:21:21 PM: y", processor);

            parser.Parse();

            processor.Result.Should().Be($"04:21:21 - x{Environment.NewLine}04:21:21 - y");
        }
        private void RefreshTransactionsInternal()
        {
            _transactionInfosInternal.Clear();

            var script = _projectService?.GetActiveScript();

            if (script == null)
            {
                return;
            }

            var scriptFilePath = script.FileName;

            if (scriptFilePath.IsNullOrWhiteSpace())
            {
                return;
            }

            var scriptDirectory = Path.GetDirectoryName(scriptFilePath);

            if (scriptDirectory.IsNullOrWhiteSpace())
            {
                return;
            }

            var outputLogFilePath = Path.Combine(scriptDirectory.EnsureNotNull(), OutputLogFileName);

            if (!File.Exists(outputLogFilePath))
            {
                return;
            }

            TransactionInfo[] transactionInfos;
            using (var parser = new OutputLogParser(outputLogFilePath))
            {
                transactionInfos = parser.Parse();
            }

            transactionInfos.DoForEach(_transactionInfosInternal.Add);
        }