public void DuplicateFilteredNamespaces() { _architectureCacheKey.Add(_baseClassModuleName, _memberDependencyTests); var duplicateCacheKey = new ArchitectureCacheKey(); duplicateCacheKey.Add(_baseClassModuleName, _memberDependencyTests); duplicateCacheKey.Add(_baseClassModuleName, _memberDependencyTests); Assert.Equal(_architectureCacheKey, duplicateCacheKey); }
public void DuplicateAssemblies() { _architectureCacheKey.Add(_baseClassModuleName, null); var duplicateCacheKey = new ArchitectureCacheKey(); duplicateCacheKey.Add(_baseClassModuleName, null); duplicateCacheKey.Add(_baseClassModuleName, null); Assert.Equal(_architectureCacheKey, duplicateCacheKey); }
public void DuplicateNamespacesDifferentOrder() { _architectureCacheKey.Add(_baseClassModuleName, _memberDependencyTests); _architectureCacheKey.Add(_baseClassModuleName, _attributeDependencyTests); var reverseOrderCacheKey = new ArchitectureCacheKey(); reverseOrderCacheKey.Add(_baseClassModuleName, _attributeDependencyTests); reverseOrderCacheKey.Add(_baseClassModuleName, _memberDependencyTests); Assert.Equal(_architectureCacheKey, reverseOrderCacheKey); }
public void DuplicateAssembliesDifferentOrder() { _architectureCacheKey.Add(_baseClassModuleName, null); _architectureCacheKey.Add(_architectureCacheTestsClassModuleName, null); var reverseOrderCacheKey = new ArchitectureCacheKey(); reverseOrderCacheKey.Add(_architectureCacheTestsClassModuleName, null); reverseOrderCacheKey.Add(_baseClassModuleName, null); Assert.Equal(_architectureCacheKey, reverseOrderCacheKey); }
public void LoadTypesForModule(ModuleDefinition module, string namespaceFilter) { _architectureCacheKey.Add(module.Name, namespaceFilter); var types = module.Types; var allTypes = types.Concat(types.SelectMany(typeDefinition => typeDefinition.NestedTypes)); allTypes .Where(typeDefinition => RegexUtils.MatchNamespaces(namespaceFilter, typeDefinition.Namespace)) .ForEach(typeDefinition => { var type = _typeFactory.GetOrCreateTypeFromTypeReference(typeDefinition); if (!_architectureTypes.Contains(type)) { _architectureTypes.Add(type); } }); _namespaceRegistry.Namespaces .Where(ns => RegexUtils.MatchNamespaces(namespaceFilter, ns.FullName)) .ForEach(ns => { _loadTaskRegistry.Add(typeof(AddTypesToNamespace), new AddTypesToNamespace(ns, _architectureTypes)); }); }
public void SameArchitecturesProduceSameArchitectureCacheKey() { _architectureCacheKey.Add(_baseClassModuleName, null); _duplicateArchitectureCacheKey.Add(_baseClassModuleName, null); Assert.Equal(_architectureCacheKey, _duplicateArchitectureCacheKey); }
public ArchitectureCacheTests() { _testArchitectureCache = new TestArchitectureCache(); _testArchitectureCacheKey = new ArchitectureCacheKey(); _testArchitectureCacheKey.Add(typeof(ArchitectureCacheTests).Assembly.FullName, null); _testEmptyArchitecture = new Architecture(new List <Assembly>(), new List <Namespace>(), new List <IType>()); }
public void LoadTypesForModule(ModuleDefinition module, string namespaceFilter) { _architectureCacheKey.Add(module.Name, namespaceFilter); ICollection <TypeDefinition> types; if (module.Types.First().FullName.Contains("<Module>")) { types = module.Types.Skip(1).ToList(); } else { types = module.Types; } var allTypes = types.Concat(types.SelectMany(typeDefinition => typeDefinition.NestedTypes.Where(type => !type.IsCompilerGenerated()))); allTypes .Where(typeDefinition => RegexUtils.MatchNamespaces(namespaceFilter, typeDefinition.Namespace)) .ForEach(typeDefinition => { var type = _typeFactory.GetOrCreateTypeFromTypeReference(typeDefinition); if (!_architectureTypes.Contains(type) && !type.IsCompilerGenerated) { _architectureTypes.Add(type); } }); _namespaceRegistry.Namespaces .Where(ns => RegexUtils.MatchNamespaces(namespaceFilter, ns.FullName)) .ForEach(ns => { _loadTaskRegistry.Add(typeof(AddTypesToNamespace), new AddTypesToNamespace(ns, _architectureTypes)); }); }