public void FindTypesWithAllDependencies_PatternMatchedNamespaces_NotReturned() { // In this example, searching for a dependency on "NamespaceMatch" should not return classes in "NamespaceMatchToo" // Arrange var search = new global::NetArchTest.Rules.Dependencies.DependencySearch(); var typeList = Types .InAssembly(Assembly.GetAssembly(typeof(HasDependency))) .That() .HaveName("NamespaceMatchingExample") .GetTypeDefinitions(); // Act var result = search.FindTypesThatHaveDependencyOnAll(typeList, new List <string> { typeof(PatternMatch).Namespace }); // Assert: Before PR#36 this would have returned classes in NamespaceMatchToo in the results Assert.Empty(result); // No results returned }
private static void FindTypesWithAnyDependencies(IEnumerable <Mono.Cecil.TypeDefinition> subjects, IEnumerable <string> dependencies, bool expectToFind) { // Arrange var search = new global::NetArchTest.Rules.Dependencies.DependencySearch(); // Act // Search against the dependencies var resultClass = search.FindTypesThatHaveDependencyOnAny(subjects, dependencies); // Assert if (expectToFind) { Assert.Equal(subjects.Count(), resultClass.Count); Assert.Equal(subjects.First().FullName, resultClass.First().FullName); } else { Assert.Equal(0, resultClass.Count); } }