public void PropertyValueProviderFqn()
 {
     var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
     var testFilter = new TFSTestFilter(null);
     var obj = TFSTestFilter.PropertyValueProvider(tc, "FullyQualifiedName");
     Assert.AreSame("Test1", obj);
 }
        /// <summary>
        /// Called by the Visual Studio IDE to run all tests. Also called by TFS Build
        /// to run either all or selected tests. In the latter case, a filter is provided
        /// as part of the run context.
        /// </summary>
        /// <param name="sources">Sources to be run.</param>
        /// <param name="runContext">Context to use when executing the tests.</param>
        /// <param name="frameworkHandle">Test log to send results and messages through</param>
        public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            testLog.Initialize(frameworkHandle);
            Info("executing tests", "started");

            try
            {
                // Ensure any channels registered by other adapters are unregistered
                CleanUpRegisteredChannels();

                var tfsfilter = new TFSTestFilter(runContext);
                testLog.SendDebugMessage("Keepalive:" + runContext.KeepAlive);
                if (!tfsfilter.HasTfsFilterValue && runContext.KeepAlive)
                    frameworkHandle.EnableShutdownAfterTestRun = true;

                foreach (var source in sources)
                {
                    using (currentRunner = new AssemblyRunner(testLog, source, tfsfilter))
                    {
                        currentRunner.RunAssembly(frameworkHandle);
                    }

                    currentRunner = null;
                }
            }
            catch (Exception ex)
            {
                testLog.SendErrorMessage("Exception " + ex);
            }
            finally
            {
                Info("executing tests", "finished");
            }
        }
 public void PropertyValueProviderCategoryFail()
 {
     var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
     tc.AddTrait("Category", "CI");
     var testFilter = new TFSTestFilter(null);
     var obj = TFSTestFilter.PropertyValueProvider(tc, "Garbage");
     Assert.Null(obj);
 }
 public void PropertyProvider()
 {
     var testfilter = new TFSTestFilter(null);
     var prop = TFSTestFilter.PropertyProvider("Priority");
     Assert.NotNull(prop);
     prop = TFSTestFilter.PropertyProvider("TestCategory");
     Assert.NotNull(prop);
 }
        public void PropertyValueProviderCategoryWithNoTraits()
        {
            CheckTraitsSupported();

            var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
            var testFilter = new TFSTestFilter(null);
            var obj = TFSTestFilter.PropertyValueProvider(tc, "TestCategory");
            Assert.IsNull(obj);
        }
 // This constructor is used when the executor is called with a list of assemblies
 public AssemblyRunner(TestLogger logger, string assemblyName, TFSTestFilter tfsFilter)
     : this(logger, assemblyName)
 {
     if (tfsFilter.HasTfsFilterValue)
     {
         var filteredTestCases = tfsFilter.CheckFilter(this.LoadedTestCases);
         this.nunitFilter = MakeTestFilter(filteredTestCases);
     }
 }
        public void PropertyValueProviderCategoryWithOneCategory()
        {
            CheckTraitsSupported();

            var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
            tc.AddTrait("Category", "CI");
            var testFilter = new TFSTestFilter(null);
            var obj = TFSTestFilter.PropertyValueProvider(tc, "TestCategory");
            Assert.AreSame("CI", obj);
        }
        public void PropertyValueProviderCategoryWithMultipleCategories()
        {
            CheckTraitsSupported();

            var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
            tc.AddTrait("Category", "CI");
            tc.AddTrait("Category", "MyOwn");
            var testFilter = new TFSTestFilter(null);
            var obj = TFSTestFilter.PropertyValueProvider(tc, "TestCategory") as string[];
            Assert.IsNotNull(obj);
            Assert.AreEqual(obj.Length,2);
            Assert.AreSame("CI", obj[0]);
            Assert.AreSame("MyOwn",obj[1]);
        }
 public void TraitProviderWithNoCategory()
 {
     var testFilter = new TFSTestFilter(null);
     var trait = TFSTestFilter.TraitProvider("JustKidding");
     Assert.Null(trait);
 }
 public void TraitProvider()
 {
     var testFilter = new TFSTestFilter(null);
     var trait = TFSTestFilter.TraitProvider("TestCategory");
     Assert.NotNull(trait);
 }