Exemple #1
0
        public void Sink_ShouldContainTestForAllSupportedTypeOfSources()
        {
            var sources = new[]
            {
                "ListContentSupport" + BoostTestDiscoverer.ExeExtension,
                "DllProject1" + BoostTestDiscoverer.DllExtension,
                "DllProject2" + BoostTestDiscoverer.DllExtension,
            };

            var context = new DefaultTestContext();
            var logger  = new ConsoleMessageLogger();
            var sink    = new DefaultTestCaseDiscoverySink();

            context.RegisterSettingProvider(BoostTestAdapterSettings.XmlRootName, new BoostTestAdapterSettingsProvider());
            context.LoadEmbeddedSettings("BoostTestAdapterNunit.Resources.Settings.externalTestRunner.runsettings");

            var boostTestDiscovererFactory = new StubBoostTestDiscovererFactory();

            var boostTestDiscoverer = new BoostTestDiscoverer(boostTestDiscovererFactory);

            boostTestDiscoverer.DiscoverTests(sources, context, logger, sink);

            Assert.That(sink.Tests, Is.Not.Empty);

            // tests are found in the using the fake debughelper
            Assert.That(sink.Tests.Count(x => x.Source == "ListContentSupport" + BoostTestDiscoverer.ExeExtension), Is.EqualTo(8));

            // the external runner does NOT support the two dll projects
            Assert.That(sink.Tests.Any(x => x.Source == "DllProject1" + BoostTestDiscoverer.DllExtension), Is.False);
            Assert.That(sink.Tests.Any(x => x.Source == "DllProject2" + BoostTestDiscoverer.DllExtension), Is.False);
        }
Exemple #2
0
        /// <summary>
        /// Deserialises a BoostTestAdapterSettings instance from the provided XML content.
        /// </summary>
        /// <param name="settingsXml">The settings XML content</param>
        /// <returns>The deserialised BoostTestAdapterSettings</returns>
        private BoostTestAdapterSettings ParseXml(string settingsXml)
        {
            BoostTestAdapterSettingsProvider provider = new BoostTestAdapterSettingsProvider();

            DefaultTestContext context = new DefaultTestContext();

            context.RegisterSettingProvider(BoostTestAdapterSettings.XmlRootName, provider);
            context.LoadSettings(settingsXml);

            return(provider.Settings);
        }
Exemple #3
0
        /// <summary>
        /// Deserialises a BoostTestAdapterSettings instance from the provided embedded resource.
        /// </summary>
        /// <param name="path">Fully qualified path to a .runsettings Xml embedded resource</param>
        /// <returns>The deserialised BoostTestAdapterSettings</returns>
        private BoostTestAdapterSettings ParseEmbeddedResource(string path)
        {
            BoostTestAdapterSettingsProvider provider = new BoostTestAdapterSettingsProvider();

            DefaultTestContext context = new DefaultTestContext();

            context.RegisterSettingProvider(BoostTestAdapterSettings.XmlRootName, provider);
            context.LoadEmbeddedSettings(path);

            return(provider.Settings);
        }
        public void DiscoverTestsUsingRunSettings()
        {
            using (DummySolution solution = new DummySolution(Source, new string[] { BoostUnitTestSampleRequiringUseOfFilters }))
            {
                DefaultTestContext context = new DefaultTestContext();
                context.RegisterSettingProvider(BoostTestAdapterSettings.XmlRootName, new BoostTestAdapterSettingsProvider());
                context.LoadEmbeddedSettings("BoostTestAdapterNunit.Resources.Settings.conditionalIncludesDisabled.runsettings");

                IEnumerable <VSTestCase> vsTests = Discover(solution, context);

                Assert.That(vsTests.Count(), Is.EqualTo(9));
                AssertBoostUnitTestSampleRequiringUseOfFilters(vsTests, solution);

                VSTestCase testConditional = AssertTestDetails(vsTests, QualifiedNameBuilder.FromString("BoostUnitTestShouldNotAppear3"), Source);
                AssertSourceDetails(testConditional, solution.SourceFileResourcePaths.First().Path, 47);
            }
        }