当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyInfo.ReadAssembly方法代码示例

本文整理汇总了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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:12,代码来源:Describe_AssemblyInfo.cs

示例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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:12,代码来源:Describe_AssemblyInfo.cs

示例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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:12,代码来源:Describe_AssemblyInfo.cs

示例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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:14,代码来源:Describe_AssemblyInfo.cs

示例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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:14,代码来源:Describe_AssemblyInfo.cs

示例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);
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:19,代码来源:Describe_AssemblyInfo.cs

示例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));
        }
开发者ID:nikkin,项目名称:NChanges,代码行数:20,代码来源:Describe_TypeInfo.cs


注:本文中的AssemblyInfo.ReadAssembly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。