public ReflectionWithRoundTripLayerTests()
        {
            mscorlib = new ProjectContentRegistry().Mscorlib;

            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent((ReflectionProjectContent)mscorlib, memory);
            memory.Position = 0;
            mscorlib        = DomPersistence.LoadProjectContent(memory, new ProjectContentRegistry());
        }
        public ReflectionWithRoundTripLayerTests()
        {
            mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib;

            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent((ReflectionProjectContent)mscorlib, memory);
            memory.Position = 0;
            mscorlib        = DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry);
        }
        protected override IEnumerable <IAttribute> GetAssemblyAttributes(Assembly assembly)
        {
            var pc = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], new ProjectContentRegistry());

            pc.AddAssemblyAttributes(assembly);

            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent(pc, memory);

            memory.Position = 0;
            return(DomPersistence.LoadProjectContent(memory, new ProjectContentRegistry()).GetAssemblyAttributes());
        }
예제 #4
0
        protected override IClass GetClass(Type type)
        {
            ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], ParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit;
            IClass           c  = new ReflectionClass(cu, type, type.FullName, null);

            cu.ProjectContent.AddClassToNamespaceList(c);

            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent((ReflectionProjectContent)c.ProjectContent, memory);

            memory.Position = 0;
            return(DomPersistence.LoadProjectContent(memory, ParserService.DefaultProjectContentRegistry).Classes.Single());
        }
        protected override IClass GetClass(Type type)
        {
            ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], new ProjectContentRegistry()).AssemblyCompilationUnit;
            IClass           c  = new ReflectionClass(cu, type, type.FullName, null);

            cu.ProjectContent.AddClassToNamespaceList(c);

            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent((ReflectionProjectContent)c.ProjectContent, memory);

            memory.Position = 0;
            ReflectionProjectContent loadedPC = DomPersistence.LoadProjectContent(memory, new ProjectContentRegistry());

            loadedPC.AddReferencedContent(mscorlib);
            return(loadedPC.Classes.Single());
        }
예제 #6
0
        public void ReflectionParserTest()
        {
            ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new AssemblyName[0], ParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit;
            IClass           c  = new ReflectionClass(cu, typeof(TestClass <,>), typeof(TestClass <,>).FullName, null);

            cu.ProjectContent.AddClassToNamespaceList(c);

            CheckClass(c);
            MemoryStream memory = new MemoryStream();

            DomPersistence.WriteProjectContent((ReflectionProjectContent)cu.ProjectContent, memory);

            memory.Position = 0;
            foreach (IClass c2 in DomPersistence.LoadProjectContent(memory, ParserService.DefaultProjectContentRegistry).Classes)
            {
                CheckClass(c2);
            }
        }