public void GetMetadata(Assembly assembly, MetadataCache cache) { ArgumentUtility.CheckNotNull("assembly", assembly); ArgumentUtility.CheckNotNull("cache", cache); Assembly securityAssembly = GetType().Assembly; _accessTypeReflector.GetAccessTypesFromAssembly(securityAssembly, cache); _accessTypeReflector.GetAccessTypesFromAssembly(assembly, cache); _abstractRoleReflector.GetAbstractRoles(securityAssembly, cache); _abstractRoleReflector.GetAbstractRoles(assembly, cache); foreach (Type type in AssemblyTypeCache.GetTypes(assembly)) { if (typeof(ISecurableObject).IsAssignableFrom(type)) { _classReflector.GetMetadata(type, cache); } } }
public void GetMetadata() { Assembly securityAssembly = typeof(IAccessTypeReflector).Assembly; Assembly assembly = typeof(File).Assembly; Expect .Call(_accessTypeReflectorMock.GetAccessTypesFromAssembly(securityAssembly, _cache)) .Return(new List <EnumValueInfo> (new EnumValueInfo[] { AccessTypes.Read, AccessTypes.Write })); Expect .Call(_accessTypeReflectorMock.GetAccessTypesFromAssembly(assembly, _cache)) .Return(new List <EnumValueInfo> (new EnumValueInfo[] { AccessTypes.Journalize, AccessTypes.Archive })); Expect.Call(_abstractRoleReflectorMock.GetAbstractRoles(securityAssembly, _cache)).Return(new List <EnumValueInfo> ()); Expect .Call(_abstractRoleReflectorMock.GetAbstractRoles(assembly, _cache)) .Return(new List <EnumValueInfo> (new EnumValueInfo[] { AbstractRoles.Clerk, AbstractRoles.Secretary, AbstractRoles.Administrator })); Expect.Call(_classReflectorMock.GetMetadata(typeof(File), _cache)).Return(new SecurableClassInfo()); Expect.Call(_classReflectorMock.GetMetadata(typeof(PaperFile), _cache)).Return(new SecurableClassInfo()); _mocks.ReplayAll(); _assemblyReflector.GetMetadata(assembly, _cache); _mocks.VerifyAll(); }