public void If_I_make_a_route_between_two_sources_twice_I_only_get_one_copy_of_each_message() { router.AddSource("srcA", null); router.AddSource("srcB", null); router.AddDestination("dst"); router.RouteSources("srcA", "srcB"); router.RouteSources("srcA", "srcB"); router.Link("srcB", "dst"); router.Send("srcA", null, null, null, "Hello"); Assert.That(router.GetAndFinish("dst", out _), Is.EqualTo("Hello")); Assert.That(router.GetAndFinish("dst", out _), Is.Null); }
void AddSourcesAndRoute([NotNull] Type type) { var interfaces = type.DirectlyImplementedInterfaces(); if (interfaces == null) { return; } foreach (var interfaceType in interfaces) { router.AddSource(interfaceType.FullName, InterfaceStack.OfInterface(interfaceType)); router.RouteSources(type.FullName, interfaceType.FullName); AddSourcesAndRoute(interfaceType); } }
public void Should_not_be_able_to_route_a_source_to_itself() { router.AddSource("A", null); Assert.Throws <ArgumentException>(() => router.RouteSources("A", "A")); }