Example #1
0
        public void VersionRegexWorksWithError()
        {
            var processResult = new ProcessResult(true, 0, "", error: "\nabcdef_v123defg\n", null);
            var version       = ToolRunner.GetVersion(new Regex("(v\\d+)"), processResult);

            Assert.Equal(Some("v123"), version);
        }
Example #2
0
        public void VersionRegexDoesNotErrorOnNullOrNonMatch(string pattern)
        {
            var regex         = pattern is null ? null : new Regex(pattern);
            var processResult = new ProcessResult(true, 0, "", error: "\nabcdef_v123defg\n", null);
            var version       = ToolRunner.GetVersion(regex, processResult);

            Assert.Equal(None, version);
        }
Example #3
0
        public void VersionRegexRequiresACaptureGroup(string pattern)
        {
            Action act = () => ToolRunner.GetVersion(new Regex(pattern), null);

            act.Should().Throw <ArgumentException>("Version regex requires exactly one capture group");
        }