public void FindType_ByIdentifier_Unique()
        {
            var project = CecilProjectTest.CreateProject();
            var type    = project.FindType("NBrowse.Test.Namespace1.Conflict");

            Assert.That(type.Name, Is.EqualTo("Conflict"));
        }
        public void FindMethod_ByIdentifier_Missing()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                        project.FindMethod("NBrowse.Test.Namespace1.Conflict.ConflictOnArguments(bool)"));
        }
        public void FindAssembly_ByName_Unique()
        {
            var project  = CecilProjectTest.CreateProject();
            var assembly = project.FindAssembly(CecilProjectTest.AssemblyName);

            Assert.That(assembly.Name, Is.EqualTo(CecilProjectTest.AssemblyName));
        }
        public void FindMethod_ByFullName_Conflict()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <AmbiguousMatchException>(() =>
                                                    project.FindMethod("NBrowse.Test.Namespace1.Conflict.ConflictOnArguments"));
        }
        public void FilterAssembly_Include()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.That(project.FilterAssemblies(new[] { "Missing1", CecilProjectTest.AssemblyName, "Missing2" }),
                        Has.Some.Matches <NBrowse.Reflection.Assembly>(a => a.Name == CecilProjectTest.AssemblyName));
        }
        public void FindMethod_ByIdentifier_Unique()
        {
            var project = CecilProjectTest.CreateProject();
            var method  = project.FindMethod("NBrowse.Test.Namespace1.Conflict.ConflictOnArguments()");

            Assert.That(method.Name, Is.EqualTo("ConflictOnArguments"));
        }
        public void FindMethod_ByParent_Unique()
        {
            var project = CecilProjectTest.CreateProject();
            var method  = project.FindMethod("Unique.ConflictOnName");

            Assert.That(method.Name, Is.EqualTo("ConflictOnName"));
        }
        public void FindMethod_ByFullName_Unique()
        {
            var project = CecilProjectTest.CreateProject();
            var method  = project.FindMethod("NBrowse.Test.Namespace2.Conflict.NoConflict");

            Assert.That(method.Name, Is.EqualTo("NoConflict"));
        }
        public void FindType_ByName_Unique()
        {
            var project = CecilProjectTest.CreateProject();
            var type    = project.FindType("Unique");

            Assert.That(type.Name, Is.EqualTo("Unique"));
        }
Beispiel #10
0
        public void FindAssembly_ByName_Missing()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <ArgumentOutOfRangeException>(() => project.FindAssembly("Missing"));
        }
Beispiel #11
0
        public void FilterAssembly_Exclude()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.That(project.FilterAssemblies(new[] { "Missing" }), Is.Empty);
        }
Beispiel #12
0
 private static Assembly GetAssembly()
 {
     return(CecilProjectTest.CreateProject().FindAssembly(typeof(CecilAssemblyTest).Assembly.GetName().Name));
 }
Beispiel #13
0
 private static Argument GetArgumentFrom(string method, int index)
 {
     return(CecilProjectTest.CreateProject().FindMethod(method).Arguments.ToArray()[index]);
 }
Beispiel #14
0
        public void Assemblies()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.That(project.Assemblies, Has.Some.Matches <NBrowse.Reflection.Assembly>(a => a.Name == CecilProjectTest.AssemblyName));
        }
Beispiel #15
0
        public void FindMethod_ByParent_Missing()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <ArgumentOutOfRangeException>(() => project.FindMethod("Conflict.Missing"));
        }
Beispiel #16
0
        public void FindMethod_ByParent_Conflict()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <AmbiguousMatchException>(() => project.FindMethod("Conflict.ConflictOnName"));
        }
Beispiel #17
0
 private static Field GetField(string name)
 {
     return(CecilProjectTest.CreateProject().FindType($"{nameof(CecilFieldTest)}+{nameof(TestClass)}").Fields
            .Single(f => f.Name == name));
 }
 private static Method GetMethod(string name)
 {
     return(CecilProjectTest.CreateProject().FindMethod(name));
 }
Beispiel #19
0
 private static Type GetType(string name)
 {
     return(CecilProjectTest.CreateProject().FindType($"{nameof(CecilTypeTest)}+{name}"));
 }
Beispiel #20
0
 private static Attribute GetAttributeFromType(string name, int index)
 {
     return(CecilProjectTest.CreateProject().FindType(name).Attributes.ToArray()[index]);
 }
Beispiel #21
0
        public void FindType_ByName_Conflict()
        {
            var project = CecilProjectTest.CreateProject();

            Assert.Throws <AmbiguousMatchException>(() => project.FindType("Conflict"));
        }
 private static NBrowse.Reflection.Type GetType(string name)
 {
     return(CecilProjectTest.CreateProject().FindType($"{nameof(CecilImplementationTest)}+{name}"));
 }
 private static Parameter GetParameterFromMethod(string name, int index)
 {
     return(CecilProjectTest.CreateProject().FindMethod(name).Parameters.ToArray()[index]);
 }