Beispiel #1
0
        public void EmptyFiltersListAlwaysPasses()
        {
            var filters = new XunitFilters();
            var method = Mocks.TestCase<ClassUnderTest>("MethodWithNoTraits");

            bool result = filters.Filter(method);

            Assert.True(result);
        }
Beispiel #2
0
        public void EmptyFiltersListAlwaysPasses()
        {
            var filters = new XunitFilters();
            var method = new TestMethod("method1", "Display Name 1", traits: null);

            bool result = filters.Filter(method);

            Assert.True(result);
        }
Beispiel #3
0
        public void CanFilterItemsByTrait()
        {
            var filters = new XunitFilters();
            var method1 = new TestMethod("method1", "Display Name 1", MakeTraits("foo", "bar"));
            var method2 = new TestMethod("method2", "Display Name 2", MakeTraits("baz", "biff"));
            var method3 = new TestMethod("method3", "Display Name 3", traits: null);
            filters.IncludedTraits.AddValue("foo", "bar");

            Assert.True(filters.Filter(method1));
            Assert.False(filters.Filter(method2));
            Assert.False(filters.Filter(method3));
        }
Beispiel #4
0
        public void CanFilterItemsByTrait()
        {
            var filters = new XunitFilters();
            var methodWithFooBar = Mocks.TestCase<ClassUnderTest>("MethodWithFooBar");
            var methodWithBazBiff = Mocks.TestCase<ClassUnderTest>("MethodWithBazBiff");
            var methodWithNoTraits = Mocks.TestCase<ClassUnderTest>("MethodWithNoTraits");
            filters.IncludedTraits.Add("foo", "bar");

            Assert.True(filters.Filter(methodWithFooBar));
            Assert.False(filters.Filter(methodWithBazBiff));
            Assert.False(filters.Filter(methodWithNoTraits));
        }
Beispiel #5
0
        public void MultipleTraitFiltersAreAnAndOperation()
        {
            var filters = new XunitFilters();
            var method1 = new TestMethod("method1", "Display Name 1", MakeTraits("foo", "bar"));
            var method2 = new TestMethod("method2", "Display Name 2", MakeTraits("baz", "biff"));
            var method3 = new TestMethod("method3", "Display Name 3", traits: null);
            filters.ExcludedTraits.AddValue("foo", "bar");
            filters.ExcludedTraits.AddValue("baz", "biff");

            Assert.False(filters.Filter(method1));
            Assert.False(filters.Filter(method2));
            Assert.True(filters.Filter(method3));
        }
Beispiel #6
0
        public void MultipleTraitFiltersAreAnAndOperation()
        {
            var filters = new XunitFilters();
            var methodWithFooBar = Mocks.TestCase<ClassUnderTest>("MethodWithFooBar");
            var methodWithBazBiff = Mocks.TestCase<ClassUnderTest>("MethodWithBazBiff");
            var methodWithNoTraits = Mocks.TestCase<ClassUnderTest>("MethodWithNoTraits");
            filters.ExcludedTraits.Add("fOo", "bAr");
            filters.ExcludedTraits.Add("bAz", "bIff");

            Assert.False(filters.Filter(methodWithFooBar));
            Assert.False(filters.Filter(methodWithBazBiff));
            Assert.True(filters.Filter(methodWithNoTraits));
        }
Beispiel #7
0

        
Beispiel #8
0
        public void FilterListWithIncludedTraitsReturnsTrue()
        {
            var filters = new XunitFilters();
            filters.IncludedTraits.AddValue("foo", "bar");

            bool isFiltered = filters.IsFiltered;

            Assert.True(isFiltered);
        }
Beispiel #9
0
        public void EmptyFilterListReturnsFalse()
        {
            var filters = new XunitFilters();

            bool isFiltered = filters.IsFiltered;

            Assert.False(isFiltered);
        }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitProject"/> class.
 /// </summary>
 public XunitProject()
 {
     assemblies = new List<XunitProjectAssembly>();
     Filters = new XunitFilters();
 }
Beispiel #11
0

        
Beispiel #12
0
        public static void MultipleNameFiltersAreAnOrOperation()
        {
            var filters = new XunitFilters();
            var method1 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name1");
            var method2 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name2");
            var method3 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass2>("Name3");
            filters.IncludedMethods.Add("Namespace1.ClassInNamespace1+InnerClass1.Name2");
            filters.IncludedClasses.Add("namespace1.classinnamespace1+InnerClass2");

            Assert.False(filters.Filter(method1));
            Assert.True(filters.Filter(method2));
            Assert.True(filters.Filter(method3));
        }
Beispiel #13
0
        public static void CanFilterFactsByWildcardName()
        {
            var filters = new XunitFilters();
            var method1 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name1");
            var method2 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name2");
            var method3 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name3");
            var method4 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass2>("Name3");
            filters.AddIncludedMethod("*.Name1");
            filters.AddIncludedMethod("Namespace1.*.Name2");
            filters.AddIncludedMethod("*+InnerClass2.*");

            Assert.True(filters.Filter(method1));
            Assert.True(filters.Filter(method2));
            Assert.False(filters.Filter(method3));
            Assert.True(filters.Filter(method4));
        }
Beispiel #14
0
        public static void EmptyFiltersListAlwaysPasses()
        {
            var filters = new XunitFilters();
            var method = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name1");

            var result = filters.Filter(method);

            Assert.True(result);
        }
Beispiel #15
0
        public static void CanFilterFactsByFullName()
        {
            var filters = new XunitFilters();
            var method1 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name1");
            var method2 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name2");
            var method3 = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass2>("Name3");
            filters.IncludedClasses.Add("Namespace1.ClassInNamespace1+InnerClass1");

            Assert.True(filters.Filter(method1));
            Assert.True(filters.Filter(method2));
            Assert.False(filters.Filter(method3));
        }