public AddOrReplaceRoutes ( string sourceKey, IList |
||
sourceKey | string | Key for the route source. |
entries | IList |
Group entries. |
Résultat | void |
public void When_group_exists_should_replace_existing_routes() { var routingTable = new UnicastRoutingTable(); var oldRoute = UnicastRoute.CreateFromEndpointName("Endpoint1"); var newRoute = UnicastRoute.CreateFromEndpointName("Endpoint2"); routingTable.AddOrReplaceRoutes("key", new List<RouteTableEntry>() { new RouteTableEntry(typeof(Command), oldRoute), }); routingTable.AddOrReplaceRoutes("key", new List<RouteTableEntry>() { new RouteTableEntry(typeof(Command), newRoute), }); var retrievedRoute = routingTable.GetRouteFor(typeof(Command)); Assert.AreSame(newRoute, 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); }