The unicast routing table.
 public void Setup()
 {
     routingTable = new UnicastRoutingTable();
     endpointInstances = new EndpointInstances();
     router = new UnicastSendRouter(
         routingTable,
         endpointInstances,
         i => i.ToString());
 }
        public void When_group_does_not_exist_should_add_routes()
        {
            var routingTable = new UnicastRoutingTable();
            var route = UnicastRoute.CreateFromEndpointName("Endpoint1");
            routingTable.AddOrReplaceRoutes("key", new List<RouteTableEntry>()
            {
                new RouteTableEntry(typeof(Command), route),
            });

            var retrievedRoute = routingTable.GetRouteFor(typeof(Command));
            Assert.AreSame(route, retrievedRoute);
        }
        public void When_routes_are_ambiguous_should_throw_exception()
        {
            var routingTable = new UnicastRoutingTable();
            var lowPriorityRoute = UnicastRoute.CreateFromEndpointName("Endpoint1");
            var highPriorityRoute = UnicastRoute.CreateFromEndpointName("Endpoint2");

            routingTable.AddOrReplaceRoutes("key2", new List<RouteTableEntry>()
            {
                new RouteTableEntry(typeof(Command), highPriorityRoute),
            });

            Assert.That(() =>
            {
                routingTable.AddOrReplaceRoutes("key1", new List<RouteTableEntry>()
                {
                    new RouteTableEntry(typeof(Command), lowPriorityRoute),
                });
            }, Throws.Exception);
        }
 static UnicastRoutingTable ApplyMappings(MessageEndpointMappingCollection mappings)
 {
     var routeTable = new UnicastRoutingTable();
     mappings.Apply(new Publishers(), routeTable, x => x, new Conventions());
     return routeTable;
 }
 static UnicastRoutingTable ApplyConfiguredRoutes(RoutingSettings routingSettings)
 {
     var routingTable = new UnicastRoutingTable();
     var configuredRoutes = routingSettings.Settings.GetOrDefault<ConfiguredUnicastRoutes>();
     configuredRoutes?.Apply(routingTable, new Conventions());
     return routingTable;
 }