Exemplo n.º 1
0
        public void IsGoogleTestExecutable_WithUnparsableRegexFromOptions_ProducesErrorMessage()
        {
            bool result = new GoogleTestDiscoverer(TestEnvironment).IsGoogleTestExecutable("my.exe", "d[ddd[");

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

            result.Should().BeFalse();
            MockLogger.Verify(l => l.LogError(It.Is<string>(s => s.Contains("'d[ddd['"))), Times.Exactly(1));
        }
        public void IsGoogleTestExecutable_WithoutIndicatorFile_IsNotRecognizedAsTestExecutable()
        {
            string testExecutable = SetupIndicatorFileTest(false);

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

                result.Should().BeFalse();
            }
            finally
            {
                string errorMessage;
                Utils.DeleteDirectory(Path.GetDirectoryName(testExecutable), out errorMessage).Should().BeTrue();
            }
        }
        public void GetTestsFromExecutable_DoNotParseSymbolInformation_DiaIsNotInvoked()
        {
            var mockFactory = new Mock <IDiaResolverFactory>();

            MockOptions.Setup(o => o.ParseSymbolInformation).Returns(false);

            IList <TestCase> testCases = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options, new ProcessExecutorFactory(), mockFactory.Object)
                                         .GetTestsFromExecutable(TestResources.Tests_DebugX86);

            mockFactory.Verify(f => f.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ILogger>()), Times.Never);
            testCases.Should().HaveCount(TestResources.NrOfTests);
            foreach (TestCase testCase in testCases)
            {
                testCase.CodeFilePath.Should().Be("");
                testCase.LineNumber.Should().Be(0);
                testCase.Source.Should().Be(TestResources.Tests_DebugX86);
                testCase.DisplayName.Should().NotBeNullOrEmpty();
                testCase.FullyQualifiedName.Should().NotBeNullOrEmpty();
            }
        }