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)); }
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)); }
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)); }
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)); }
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); }
public void EmptyFiltersListAlwaysPasses() { var filters = new XunitFilters(); var method = Mocks.TestCase<ClassUnderTest>("MethodWithNoTraits"); bool result = filters.Filter(method); Assert.True(result); }
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)); }
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)); }
public static void EmptyFiltersListAlwaysPasses() { var filters = new XunitFilters(); var method = Mocks.TestCase<Namespace1.ClassInNamespace1.InnerClass1>("Name1"); var result = filters.Filter(method); Assert.True(result); }
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)); }