コード例 #1
0
        protected AbstractCoreTests()
        {
            MockLogger = new Mock<ILogger>();
            MockOptions = new Mock<SettingsWrapper>();
            MockFrameworkReporter = new Mock<ITestFrameworkReporter>();

            TestEnvironment = new TestEnvironment(MockOptions.Object, MockLogger.Object);
            TestDataCreator = new TestDataCreator(TestEnvironment);
        }
コード例 #2
0
        protected AbstractCoreTests()
        {
            MockLogger            = new Mock <ILogger>();
            MockOptions           = new Mock <SettingsWrapper>();
            MockFrameworkReporter = new Mock <ITestFrameworkReporter>();

            TestEnvironment = new TestEnvironment(MockOptions.Object, MockLogger.Object);
            TestDataCreator = new TestDataCreator(TestEnvironment);
        }
コード例 #3
0
        public void GetTestsFromExecutable_WithoutPathExtension_ProducesWarning()
        {
            string baseDir = TestDataCreator.PreparePathExtensionTest();

            try
            {
                string targetExe = TestDataCreator.GetPathExtensionExecutable(baseDir);

                var discoverer             = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options);
                IList <TestCase> testCases = discoverer.GetTestsFromExecutable(targetExe);

                testCases.Count.Should().Be(0);
                MockLogger.Verify(l => l.LogError(It.Is <string>(s => s.StartsWith("Could not list test cases of executable"))));
            }
            finally
            {
                Utils.DeleteDirectory(baseDir).Should().BeTrue();
            }
        }
コード例 #4
0
        public void GetTestsFromExecutable_WithPathExtension_FindsTestsWithLocation()
        {
            string baseDir = TestDataCreator.PreparePathExtensionTest();

            try
            {
                string targetExe = Path.Combine(baseDir, "exe", Path.GetFileName(TestResources.DllTests_ReleaseX86));
                MockOptions.Setup(o => o.PathExtension).Returns(SettingsWrapper.ExecutableDirPlaceholder + @"\..\dll");

                var discoverer             = new GoogleTestDiscoverer(TestEnvironment.Logger, TestEnvironment.Options);
                IList <TestCase> testCases = discoverer.GetTestsFromExecutable(targetExe);

                testCases.Count.Should().Be(TestResources.NrOfDllTests);
            }
            finally
            {
                Utils.DeleteDirectory(baseDir).Should().BeTrue();
            }
        }