public void TraitProviderWithNoCategory()
        {
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var trait      = VsTestFilter.TraitProvider("JustKidding");

            Assert.That(trait, Is.Null);
        }
        public void PropertyValueProviderFqn()
        {
            var tc         = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var obj        = VsTestFilter.PropertyValueProvider(tc, "FullyQualifiedName");

            Assert.That(obj, Is.SameAs("Test1"));
        }
        public void PropertyValueProviderWithNoTraitsAndCategoryAsFilter()
        {
            var tc         = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var obj        = VsTestFilter.PropertyValueProvider(tc, "Category");

            Assert.That(obj, Is.Null);
        }
        public void TraitProvider()
        {
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var trait      = VsTestFilter.TraitProvider("TestCategory");

            Assert.That(trait, Is.Not.Null);
            trait = VsTestFilter.TraitProvider("Category");
            Assert.That(trait, Is.Not.Null);
        }
        public static VsTestFilter CreateTestFilter(ITestCaseFilterExpression filterExpression)
        {
            var context = Substitute.For <IRunContext>();

            context.GetTestCaseFilter(null, null).ReturnsForAnyArgs(filterExpression);
            var settings = Substitute.For <IAdapterSettings>();

            settings.DiscoveryMethod.Returns(DiscoveryMethod.Legacy);
            return(VsTestFilterFactory.CreateVsTestFilter(settings, context));
        }
        public void PropertyValueProviderCategoryFail()
        {
            var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");

            tc.AddTrait("Category", "CI");
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var obj        = VsTestFilter.PropertyValueProvider(tc, "Garbage");

            Assert.That(obj, Is.Null);
        }
        public void PropertyProvider()
        {
            var testfilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var prop       = VsTestFilter.PropertyProvider("Priority");

            Assert.That(prop, Is.Not.Null);
            prop = VsTestFilter.PropertyProvider("TestCategory");
            Assert.That(prop, Is.Not.Null);
            prop = VsTestFilter.PropertyProvider("Category");
            Assert.That(prop, Is.Not.Null);
        }
        public void PropertyValueProviderWithMultipleCategoriesAndCategoryAsFilter()
        {
            var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");

            tc.AddTrait("Category", "CI");
            tc.AddTrait("Category", "MyOwn");
            var testFilter = VsTestFilterFactory.CreateVsTestFilter(settings, null);
            var obj        = VsTestFilter.PropertyValueProvider(tc, "Category") as string[];

            Assert.That(obj, Is.Not.Null);
            Assert.That(obj.Length, Is.EqualTo(2));
            Assert.That(obj[0], Is.SameAs("CI"));
            Assert.That(obj[1], Is.SameAs("MyOwn"));
        }