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); }
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); }
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)); }
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); }
public void FindsPublicDelegates() { var result = AttributeLocator.FindMembersDecoratedWith <ExampleAttribute>(GetType().Assembly); Assert.That(result, Contains.Item(typeof(PublicDelegate))); }