Beispiel #1
0
        public void FindsNonPublicMethods()
        {
            var results = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly).ToList();

            var expected = typeof(PublicClass).GetMethod("PrivateMethod", BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.That(results.OfType <MethodInfo>().SingleOrDefault(m => AreEqual(m, expected)), Is.Not.Null);
        }
Beispiel #2
0
        public void FindsNonPublicConstructors()
        {
            var results = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly).ToList();

            var expected = typeof(PublicClass).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).Single();

            Assert.That(results.OfType <ConstructorInfo>().SingleOrDefault(c => AreEqual(c, expected)), Is.Not.Null);
        }
Beispiel #3
0
        public void FindsNonPublicDelegates()
        {
            var results = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly).ToList();

            var expected = (Type)typeof(PublicClass).GetMember("PrivateDelegate", BindingFlags.NonPublic).Single();

            Assert.That(results, Contains.Item(expected));
        }
Beispiel #4
0
        public void FindsPublicEvents()
        {
            var results = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly).ToList();

            var expected = typeof(PublicClass).GetEvent("PublicEvent");

            Assert.That(results.OfType <EventInfo>().SingleOrDefault(e => AreEqual(e, expected)), Is.Not.Null);
        }
Beispiel #5
0
        public void FindsPublicDelegates()
        {
            var result = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly);

            Assert.That(result, Contains.Item(typeof(PublicDelegate)));
        }