public RouteToEndpoint ( |
||
assembly | The assembly whose messages should be routed. | |
destination | string | Destination endpoint. |
return | void |
public void WhenPassingTransportAddressForSenderInsteadOfEndpointName_UsingAssemblyAndNamespace_ShouldThrowException() { var routingSettings = new RoutingSettings(new SettingsHolder()); var expectedExceptionMessage = expectedExceptionMessageForWrongEndpointName; var exception = Assert.Throws<ArgumentException>(() => routingSettings.RouteToEndpoint(Assembly.GetExecutingAssembly(), nameof(MessageNamespaceA), "EndpointName@MyHost")); Assert.AreEqual(expectedExceptionMessage, exception.Message); }
public void WhenRoutingMessageTypeToEndpoint_ShouldConfigureMessageTypeInRoutingTable() { var routingSettings = new RoutingSettings(new SettingsHolder()); routingSettings.RouteToEndpoint(typeof(SomeMessageType), "destination"); var routingTable = ApplyConfiguredRoutes(routingSettings); var route = routingTable.GetRouteFor(typeof(SomeMessageType)); Assert.That(route, Is.Not.Null); Assert.That(route.Endpoint, Is.EqualTo("destination")); }
public void WhenRoutingAssemblyWithNamespaceToEndpoint_ShouldOnlyConfigureMessagesWithinThatNamespace() { var routingSettings = new RoutingSettings(new SettingsHolder()); routingSettings.RouteToEndpoint(Assembly.GetExecutingAssembly(), nameof(MessageNamespaceA), "destination"); var routingTable = ApplyConfiguredRoutes(routingSettings); var someMessageRoute = routingTable.GetRouteFor(typeof(SomeMessageType)); var otherMessageRoute = routingTable.GetRouteFor(typeof(OtherMessageType)); var messageWithoutNamespaceRoute = routingTable.GetRouteFor(typeof(MessageWithoutNamespace)); Assert.That(someMessageRoute, Is.Not.Null, "because SomeMessageType is in the given namespace"); Assert.That(otherMessageRoute, Is.Null, "because OtherMessageType is not in the given namespace"); Assert.That(messageWithoutNamespaceRoute, Is.Null, "because MessageWithoutNamespace is not in the given namespace"); }
public void WhenRoutingAssemblyToEndpoint_ShouldConfigureAllContainedMessagesInRoutingTable() { var routingSettings = new RoutingSettings(new SettingsHolder()); routingSettings.RouteToEndpoint(Assembly.GetExecutingAssembly(), "destination"); var routingTable = ApplyConfiguredRoutes(routingSettings); var someMessageRoute = routingTable.GetRouteFor(typeof(SomeMessageType)); var otherMessageRoute = routingTable.GetRouteFor(typeof(OtherMessageType)); var messageWithoutNamespaceRoute = routingTable.GetRouteFor(typeof(MessageWithoutNamespace)); Assert.That(someMessageRoute, Is.Not.Null); Assert.That(otherMessageRoute, Is.Not.Null); Assert.That(messageWithoutNamespaceRoute, Is.Not.Null); }
public void WhenRoutingAssemblyWithNamespaceToEndpointAndSpecifyingEmptyNamespace_ShouldOnlyConfigureMessagesWithinEmptyNamespace(string emptyNamespace) { var routingSettings = new RoutingSettings(new SettingsHolder()); routingSettings.RouteToEndpoint(Assembly.GetExecutingAssembly(), emptyNamespace, "destination"); var routingTable = ApplyConfiguredRoutes(routingSettings); var someMessageRoute = routingTable.GetRouteFor(typeof(SomeMessageType)); var otherMessageRoute = routingTable.GetRouteFor(typeof(OtherMessageType)); var messageWithoutNamespaceRoute = routingTable.GetRouteFor(typeof(MessageWithoutNamespace)); Assert.That(someMessageRoute, Is.Null); Assert.That(otherMessageRoute, Is.Null); Assert.That(messageWithoutNamespaceRoute, Is.Not.Null); }