Example #1
0
 /// <summary>
 /// Build all dependant types into the messaging server
 /// </summary>
 /// <param name="type"></param>
 public void BuildRoutes([NotNull] Type type)
 {
     if (type == null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     if (type.IsInterface)
     {
         router.AddSource(type.FullName, InterfaceStack.OfInterface(type));
     }
     AddSourcesAndRoute(type);
 }
Example #2
0
        public void If_I_add_a_source_twice_I_get_one_source_and_no_errors()
        {
            router.AddSource("S", null);
            router.AddSource("S", null);

            Assert.That(query.ListSources().Count(e => e.name == "S"), Is.EqualTo(1));
        }
        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");
        }