//[Row(null)] public void ToStringTest(Type type) { string namespaceName = type.Namespace; NamespaceFilter<ITestDescriptor> filter = new NamespaceFilter<ITestDescriptor>( new EqualityFilter<string>(namespaceName)); Assert.AreEqual("Namespace(Equality('" + namespaceName + "'))", filter.ToString()); }
public void no_filters_means_that_everything_is_revoked() { var sut = new NamespaceFilter(); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); actual.Should().BeFalse(); }
public void no_filters_means_that_everything_is_revoked() { var sut = new NamespaceFilter(); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); Assert.AreEqual(actual, false); }
private Filter <ITestDescriptor> GetNamespaceFilter(TestTreeNode namespaceNode) { var equalityFilter = new EqualityFilter <string>(namespaceNode.Id); var namespaceFilter = new NamespaceFilter <ITestDescriptor>(equalityFilter); if (optionsController.NamespaceHierarchy == NamespaceHierarchy.Flat) { return(namespaceFilter); } var filters = new List <Filter <ITestDescriptor> > { namespaceFilter }; foreach (var n in namespaceNode.Nodes) { var node = n as NamespaceNode; if (node == null) { continue; } var filter = GetNamespaceFilter(node); if (filter != null) { filters.Add(filter); } } return(filters.Count > 1 ? new OrFilter <ITestDescriptor>(filters) : filters[0]); }
public void FilterNamespace(NamespaceFilter filter) { filter.Add(this); foreach (var name in Generics) { name.FilterNamespace(filter); } }
//[Row(null)] public void ToStringTest(Type type) { string namespaceName = type.Namespace; NamespaceFilter <ITestDescriptor> filter = new NamespaceFilter <ITestDescriptor>( new EqualityFilter <string>(namespaceName)); Assert.AreEqual("Namespace(Equality('" + namespaceName + "'))", filter.ToString()); }
public static ITypeName GetTypeName(this Type type, TypeNameFlag flags = TypeNameFlag.Default) { var name = TypeNameFactory.Create(type, flags); var filter = new NamespaceFilter(); name.FilterNamespace(filter); filter.ClearNamespace(); return(name); }
public void child_ns_is_configured_to_NOT_be_allowed__so_dont_allow_it() { var sut = new NamespaceFilter(); sut.Allow("MicroServer", false); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); Assert.AreEqual(actual, false); }
public void child_ns_is_configured_to_be_allowed__so_allow_it() { var sut = new NamespaceFilter(); sut.Allow("Griffin", true); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); actual.Should().BeTrue(); }
public static IMethodName GetDefinitionName(this MethodInfo method, TypeNameFlag flags = TypeNameFlag.Default) { var name = new MethodName(method, flags); var filter = new NamespaceFilter(); name.FilterNamespace(filter); filter.ClearNamespace(); return(name); }
public void allow_root_but_reject_specific_child__make_sure_that_the_root_is_allowed() { var sut = new NamespaceFilter(); sut.Revoke(typeof(NoFilter).Namespace, false); sut.Allow("Griffin", true); var actual = sut.IsSatisfiedBy(typeof(GuidFactory)); actual.Should().BeTrue(); }
public void allow_root_but_reject_specific_child() { var sut = new NamespaceFilter(); sut.Revoke(typeof(NoFilter).Namespace, false); sut.Allow("Griffin", true); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); actual.Should().BeFalse("because a specific filter was set"); }
public void allow_root_but_reject_specific_child() { var sut = new NamespaceFilter(); sut.Revoke(typeof(NoFilter).Namespace, false); sut.Allow("MicroServer", true); var actual = sut.IsSatisfiedBy(typeof(NoFilter)); Assert.AreEqual(actual, false, "because a specific filter was set"); }
public void allow_root_but_reject_specific_child__make_sure_that_the_root_is_allowed() { var sut = new NamespaceFilter(); sut.Revoke(typeof(NoFilter).Namespace, false); sut.Allow("MicroServer", true); var actual = sut.IsSatisfiedBy(typeof(Guid)); Assert.AreEqual(actual, true); }
public void FilterNamespace(NamespaceFilter filter) { ReturnType.FilterNamespace(filter); ExplicitInterface?.FilterNamespace(filter); foreach (var name in Generics) { name.FilterNamespace(filter); } foreach (var parameter in Parameters) { parameter.TypeName.FilterNamespace(filter); } }
public void TestOtherNamespaceWithoutChildren() { var filter = new NamespaceFilter("Bajs", false); Assert.False(filter.CanLog(GetType(), LogLevel.Debug)); }
public void TestThisNamespaceWithChildren() { var filter = new NamespaceFilter("Griffin.Logging.Tests.Filters", true); Assert.True(filter.CanLog(GetType(), LogLevel.Debug)); }
public void TestParentNamespaceWithoutChildren() { var filter = new NamespaceFilter("Griffin.Logging.Tests", false); Assert.False(filter.CanLog(GetType(), LogLevel.Debug)); }
private Filter<ITestDescriptor> GetNamespaceFilter(TestTreeNode namespaceNode) { var equalityFilter = new EqualityFilter<string>(namespaceNode.Id); var namespaceFilter = new NamespaceFilter<ITestDescriptor>(equalityFilter); if (optionsController.NamespaceHierarchy == NamespaceHierarchy.Flat) return namespaceFilter; var filters = new List<Filter<ITestDescriptor>> { namespaceFilter }; foreach (var n in namespaceNode.Nodes) { var node = n as NamespaceNode; if (node == null) continue; var filter = GetNamespaceFilter(node); if (filter != null) { filters.Add(filter); } } return filters.Count > 1 ? new OrFilter<ITestDescriptor>(filters) : filters[0]; }