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); }
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); }
public void VersionRegexRequiresACaptureGroup(string pattern) { Action act = () => ToolRunner.GetVersion(new Regex(pattern), null); act.Should().Throw <ArgumentException>("Version regex requires exactly one capture group"); }