public void If_I_add_a_destination_twice_I_get_one_destination_and_no_errors() { router.AddDestination("B"); router.AddDestination("B"); Assert.That(query.ListDestinations().Count(e => e.name == "B"), Is.EqualTo(1)); }
public void When_sending_a_message_with_mulitple_inheritance_should_receive_one_copy_at_base_level() { subject.BuildRoutes(typeof(IFile)); router.AddDestination("dst"); router.Link("Example.Types.IMsg", "dst"); router.Send("Example.Types.IFile", null, null, null, "Hello"); Assert.That(router.GetAndFinish("dst", out _), Is.EqualTo("Hello")); Assert.That(router.GetAndFinish("dst", out _), Is.Null); }
public void SetUp() { var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings(); var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig(); subject = new RabbitRouter(longTermConnection, shortTermConnection); typeRouter = new TypeRouter(subject); typeRouter.BuildRoutes(typeof(IFile)); subject.AddDestination("dst"); subject.Link("Example.Types.IMsg", "dst"); subject.Send("Example.Types.IFile", "Hello"); }
public void SetUp() { var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings(); var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig(); subject = new RabbitRouter(longTermConnection, shortTermConnection); typeRouter = new TypeRouter(subject); typeRouter.BuildRoutes(typeof(IFile)); subject.AddDestination("dst"); subject.Link("Example.Types.IMsg", "dst"); subject.Send("Example.Types.IFile", null, null, null, "Hello"); }
/// <summary> /// Ensure a destination exists, and bind it to the exchanges for the given type /// </summary> public void CreateDestination([NotNull] Type sourceType, [NotNull] string destinationName, [NotNull] Expires messageExpiry) { RouteSource(sourceType); if (messageExpiry.Milliseconds > 0) { messageRouter.AddLimitedDestination(destinationName, messageExpiry); } else { messageRouter.AddDestination(destinationName); } messageRouter.Link(sourceType.FullName, destinationName); }
public void Router_can_remove_routing() { router.AddSource("A", null); router.AddDestination("B"); Assert.IsTrue(query.ListSources().Any(e => e.name == "A"), "Exchange not created"); Assert.IsTrue(query.ListDestinations().Any(e => e.name == "B"), "Queue not created"); ((RabbitRouter)router).RemoveRouting(n => true); Assert.IsFalse(query.ListSources().Any(e => e.name == "A"), "Exchange not cleared"); Assert.IsFalse(query.ListDestinations().Any(e => e.name == "B"), "Queue not cleared"); }