IsGoogleTestExecutable() public method

public IsGoogleTestExecutable ( string executable, string customRegex = "" ) : bool
executable string
customRegex string
return bool
        public void IsGoogleTestExecutable_WithUnparsableRegexFromOptions_ProducesErrorMessage()
        {
            bool result = GoogleTestDiscoverer.IsGoogleTestExecutable("my.exe", "d[ddd[", TestEnvironment.Logger);

            result.Should().BeFalse();
            MockLogger.Verify(l => l.LogError(It.Is <string>(s => s.Contains("'d[ddd['"))), Times.Exactly(1));
        }
        public void IsGoogleTestExecutable_DependingOnGtestDllX64_IsRecognizedAsTestExecutable()
        {
            bool result = GoogleTestDiscoverer
                          .IsGoogleTestExecutable(TestResources.FakeGtestDllExeX64, "", TestEnvironment.Logger);

            result.Should().BeTrue();
        }
        public void IsGoogleTestExecutable_WithoutIndicatorFile_IsRecognizedAsTestExecutable()
        {
            string testExecutable = SetupIndicatorFileTest(false);

            try
            {
                bool result = GoogleTestDiscoverer
                              .IsGoogleTestExecutable(testExecutable, "", TestEnvironment.Logger);

                result.Should().BeTrue();
            }
            finally
            {
                string errorMessage;
                Utils.DeleteDirectory(Path.GetDirectoryName(testExecutable), out errorMessage).Should().BeTrue();
            }
        }
        public void IsGoogleTestExecutable_WithSlowRegex_TimesOutAndProducesErrorMessage()
        {
            // regex from https://stackoverflow.com/questions/9687596/slow-regex-performance
            string slowRegex = "\"(([^\\\\\"]*)(\\\\.)?)*\"";

            var  stopwatch = Stopwatch.StartNew();
            bool result    = GoogleTestDiscoverer.IsGoogleTestExecutable(
                "\"This is an unterminated string and takes FOREVER to match",
                slowRegex,
                TestEnvironment.Logger);

            stopwatch.Stop();

            result.Should().BeFalse();
            MockLogger.Verify(l => l.LogError(It.Is <string>(s => s.Contains($"'{slowRegex}'") && s.Contains("timed out"))), Times.Exactly(1));
            stopwatch.Elapsed.Should().BeCloseTo(GoogleTestDiscoverer.RegexTimeout, 250);
        }
 private void AssertIsGoogleTestExecutable(string executable, bool isGoogleTestExecutable, string regex = "")
 {
     GoogleTestDiscoverer.IsGoogleTestExecutable(executable, regex, TestEnvironment.Logger)
     .Should()
     .Be(isGoogleTestExecutable);
 }