Exemple #1
0
        public void BuildFromStream(Stream stream)
        {
            var assemblySymbol = AssemblyApiView.GetCompilation(stream);

            this.AssemblyNode = new CodeFileBuilder().Build(assemblySymbol);
            this.Name         = assemblySymbol.Name;
        }
        public void AssemblyTestAssemblyFromSymbol()
        {
            IAssemblySymbol assemblySymbol = TestResource.GetAssemblySymbol();
            AssemblyApiView assembly       = new AssemblyApiView(assemblySymbol);

            Assert.Equal("TestLibrary", assembly.Name);

            Assert.Single(assembly.GlobalNamespace.Namespaces);
        }
        public void AssemblyTestAssembliesFromFile()
        {
            AssemblyApiView assembly = AssemblyApiView.AssemblyFromFile("TestLibrary.dll");

            Assert.Equal("TestLibrary", assembly.Name);

            NamespaceApiView globalNamespace = assembly.GlobalNamespace;

            Assert.Single(globalNamespace.Namespaces);
        }
        public void NamespaceTestGlobalNoNamedTypesSomenamespaces()
        {
            AssemblyApiView assembly = new AssemblyApiView(TestResource.GetAssemblySymbol());

            Assert.Equal("TestLibrary", assembly.Name);

            NamespaceApiView globalNamespace = assembly.GlobalNamespace;

            Assert.Empty(globalNamespace.NamedTypes);
            Assert.Single(globalNamespace.Namespaces);
        }
        public void NamespaceTestNonGlobalSomeNamedTypesNonamespacesStringRep()
        {
            AssemblyApiView assembly = new AssemblyApiView(TestResource.GetAssemblySymbol());

            Assert.Equal("TestLibrary", assembly.Name);

            NamespaceApiView globalNamespace = assembly.GlobalNamespace;
            NamespaceApiView nestedNamespace = globalNamespace.Namespaces[0];

            Assert.Contains("namespace TestLibrary {", nestedNamespace.ToString());
        }
Exemple #6
0
        public static object GetTestMember(string typeName, string memberName = null)
        {
            var compilation = AssemblyApiView.GetCompilation("TestLibrary.dll");

            if (memberName != null)
            {
                return(compilation.GetTypeByMetadataName(typeName).GetMembers(memberName).Single());
            }
            else
            {
                return(compilation.GetTypeByMetadataName(typeName));
            }
        }
        public void NamespaceTestNonGlobalSomeNamedTypesNonamespaces()
        {
            AssemblyApiView assembly = new AssemblyApiView(TestResource.GetAssemblySymbol());

            Assert.Equal("TestLibrary", assembly.Name);

            NamespaceApiView globalNamespace = assembly.GlobalNamespace;
            NamespaceApiView nestedNamespace = globalNamespace.Namespaces[0];

            Assert.Equal("TestLibrary", nestedNamespace.Name);

            Assert.NotEmpty(nestedNamespace.NamedTypes);
            Assert.Empty(nestedNamespace.Namespaces);
        }
Exemple #8
0
 public static IAssemblySymbol GetAssemblySymbol()
 {
     return(AssemblyApiView.GetCompilation("TestLibrary.dll"));
 }
 public AssemblyModel(AssemblyApiView assembly, string fileName)
 {
     this.Assembly  = assembly;
     this.Name      = fileName;
     this.TimeStamp = DateTime.UtcNow;
 }
 public AssemblyModel(Stream stream, string fileName)
 {
     this.Assembly  = AssemblyApiView.AssemblyFromStream(stream);
     this.Name      = fileName;
     this.TimeStamp = DateTime.UtcNow;
 }