コード例 #1
0
        public void Should_find_nested_classes()
        {
            var locator = new CecilReflectionProvider(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var method  = locator.LocateMethod("AutoTest.Test.Core.ReflectionProviders.BaseClass+MyNestedClass+MyNestedNestedClass.SomeMethod");

            Assert.AreEqual("AutoTest.Test.Core.ReflectionProviders.BaseClass+MyNestedClass+MyNestedNestedClass.SomeMethod", method.Fullname);
        }
コード例 #2
0
        public void Should_find_me()
        {
            var locator = new CecilReflectionProvider(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var method  = locator.LocateMethod("AutoTest.Test.Core.ReflectionProviders.CecilReflectionProviderTests.Should_find_me");

            Assert.AreEqual("AutoTest.Test.Core.ReflectionProviders.CecilReflectionProviderTests.Should_find_me", method.Fullname);
            Assert.AreEqual("NUnit.Framework.TestAttribute", method.Attributes.ElementAt(0));
        }
コード例 #3
0
        public void Should_find_inherited_attributes_in_methods()
        {
            var locator = new CecilReflectionProvider(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var method  = locator.LocateMethod("AutoTest.Test.Core.ReflectionProviders.BaseClass.Blargh");

            Assert.AreEqual("AutoTest.Test.Core.ReflectionProviders.BaseClass.Blargh", method.Fullname);
            Assert.AreEqual(3, method.Attributes.Count());
        }
コード例 #4
0
        public void Should_find_returns_types_as_nested_classes()
        {
            var locator = new CecilReflectionProvider(Assembly.GetExecutingAssembly().Location);
            var method  = locator.LocateMethod("AutoTest.Test.Core.ReflectionProviders.BaseClass+MyNestedClass+MyNestedNestedClass.ReturningMethod");

            Assert.AreEqual("AutoTest.Test.Core.ReflectionProviders.BaseClass+MyNestedClass+MyNestedNestedClass.ReturningMethod", method.Fullname);
            Assert.AreEqual("AutoTest.Test.Core.ReflectionProviders.BaseClass+MyNestedClass", method.ReturnType);
        }