本文整理汇总了C#中AssemblyInfo.ReadAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyInfo.ReadAssembly方法的具体用法?C# AssemblyInfo.ReadAssembly怎么用?C# AssemblyInfo.ReadAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyInfo
的用法示例。
在下文中一共展示了AssemblyInfo.ReadAssembly方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: It_reads_the_assembly_name
public void It_reads_the_assembly_name()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly("MyAssembly.dll",
@"namespace MyNamespace
{
public class MyClass { }
}"));
Assert.AreEqual("MyAssembly", assemblyInfo.Name);
}
示例2: It_finds_public_types
public void It_finds_public_types()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"namespace MyNamespace
{
public class MyClass { }
}"));
Assert.AreEqual(1, assemblyInfo.Types.Count);
}
示例3: It_doesnt_find_internal_types
public void It_doesnt_find_internal_types()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"namespace MyNamespace
{
internal class MyInternalClass { }
}"));
Assert.AreEqual(0, assemblyInfo.Types.Count);
}
示例4: It_reads_the_assembly_version
public void It_reads_the_assembly_version()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"[assembly: System.Reflection.AssemblyVersion(""1.2.3.4"")]
namespace MyNamespace
{
public class MyClass { }
}"));
Assert.AreEqual("1.2.3.4", assemblyInfo.Version);
}
示例5: It_can_exclude_specified_types
public void It_can_exclude_specified_types()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"namespace MyNamespace
{
public class MyClass1 { }
public class MyClass2 { }
}"), "Class2");
Assert.AreEqual("MyClass1", assemblyInfo.Types.Single().Name);
}
示例6: It_strips_the_version_culture_and_public_key_token_from_parameter_types
public void It_strips_the_version_culture_and_public_key_token_from_parameter_types()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"[assembly: System.Reflection.AssemblyVersion(""1.2.3.4"")]
namespace MyNamespace
{
public class MyClass
{
public void MyMethod(System.Collections.Generic.IEnumerable<MyClass> obj) { }
}
}"));
Assert.AreEqual(
"System.Collections.Generic.IEnumerable`1[[MyNamespace.MyClass, MyAssembly]]",
assemblyInfo.Types.Single().Members.Get("MyMethod").Parameters.Single().Type);
}
示例7: It_detects_the_type_kind
public void It_detects_the_type_kind()
{
var assemblyInfo = new AssemblyInfo();
assemblyInfo.ReadAssembly(Compiler.GetAssembly(
@"namespace MyNamespace
{
public class MyClass { }
public struct MyStruct { }
public interface MyInterface { }
public enum MyEnum { }
public delegate void MyDelegate();
}"));
Assert.IsTrue(assemblyInfo.Types.Any(m => m.Name == "MyClass" && m.Kind == TypeKind.Class));
Assert.IsTrue(assemblyInfo.Types.Any(m => m.Name == "MyStruct" && m.Kind == TypeKind.ValueType));
Assert.IsTrue(assemblyInfo.Types.Any(m => m.Name == "MyInterface" && m.Kind == TypeKind.Interface));
Assert.IsTrue(assemblyInfo.Types.Any(m => m.Name == "MyEnum" && m.Kind == TypeKind.Enum));
Assert.IsTrue(assemblyInfo.Types.Any(m => m.Name == "MyDelegate" && m.Kind == TypeKind.Delegate));
}