Пример #1
0
        public void GetAssemblies_Test()
        {
            var dtoMapper = new DtoMapperInitializer();

            var assemblies    = AppDomain.CurrentDomain.GetAssemblies();
            var rmsAssemblies = assemblies.Where(a => a.FullName.Contains("ReportMS"));

            var types = rmsAssemblies.SelectMany(a => a.GetTypes());

            Assert.IsNotNull(types);
        }
Пример #2
0
        public void GetAssemblies3_Test()
        {
            var dtoMapper = new DtoMapperInitializer();


            //var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            //var rmsAssemblies = assemblies.Where(a => a.FullName.Contains("ReportMS")).ToList();

            //var types = rmsAssemblies.SelectMany(a => a.GetTypes().Where(s => typeof(IApplicationStartup).IsAssignableFrom(s))).ToList();

            var types = (from a in AppDomain.CurrentDomain.GetAssemblies()
                         where a.GlobalAssemblyCache == false
                         from t in a.GetTypes()
                         where t.IsClass && typeof(IApplicationStartup).IsAssignableFrom(t)
                         select t).ToList();

            Assert.IsNotNull(types);
        }