public void Non_generic_interface_is_properly_handled() { var builder = new InterfaceBasedBuilder(typeof(ItfNonGenericForHandles)).MakeBuilder(); var targetToAdapt = new AHandlerThroughSimpleInterface(); var subs = builder.BuildSubscriptions(targetToAdapt); subs.ShouldHaveCount(1); var s = subs.First(); s.Handles(typeof(MessageA)).ShouldBeTrue(); s.Push(new MessageA()); targetToAdapt.MsgCount.ShouldBeEqualTo(1); }
public void Two_subscriptions_expected_from_aquainting_crazy_handler() { var builder = new InterfaceBasedBuilder(typeof (IClassicIHandleStuffI<>)).MakeBuilder(); var subs = builder.BuildSubscriptions(new SomeCrazyHandler()); subs.ShouldHaveCount(2); }
public void explicit_implementation_of_interfaces_is_supported() { var builder = new InterfaceBasedBuilder(typeof(IClassicIHandleStuffI<>)).MakeBuilder(); var subs = builder.BuildSubscriptions(new HandlerWithExplicitImpl()); subs.ShouldHaveCount(1); }
public void These_handler_interfaces_will_return_zero_endpoints(Type implementation, int expectedCandidateCount) { var interfaceType = implementation.GetInterfaces().First(); var obj = Activator.CreateInstance(implementation); var bld = new InterfaceBasedBuilder(interfaceType); var meths = bld.GetMethodInfos(obj).ToList(); meths.ShouldHaveCount(expectedCandidateCount); }