public void AddMessageRoute_AddsActorRoute() { var actor = ReceiverIdentities.CreateForActor(); var localSocket = new LocalSocket <IMessage>(); var messageIdentifier = MessageIdentifier.Create <SimpleMessage>(); var registration = new InternalRouteRegistration { ReceiverIdentifier = actor, DestinationSocket = localSocket, MessageContracts = new[] { new MessageContract { Message = messageIdentifier } } }; // internalRoutingTable.AddMessageRoute(registration); // var lookupRequest = new InternalRouteLookupRequest { ReceiverIdentity = actor, Message = messageIdentifier }; var socket = internalRoutingTable.FindRoutes(lookupRequest).First(); Assert.AreEqual(localSocket, socket); }
public void AddMessageRoute_AddsMessageHubRoute() { var messageHub = ReceiverIdentities.CreateForMessageHub(); var localSocket = new LocalSocket <IMessage>(); var registration = new InternalRouteRegistration { ReceiverIdentifier = messageHub, DestinationSocket = localSocket }; // internalRoutingTable.AddMessageRoute(registration); // var lookupRequest = new InternalRouteLookupRequest { ReceiverIdentity = messageHub }; var socket = internalRoutingTable.FindRoutes(lookupRequest).First(); Assert.AreEqual(localSocket, socket); }
public void FindRoutesByMessageHubReceiverIdentity_ReturnsMessageHubSocket() { var registrations = EnumerableExtensions.Produce(Randomizer.Int32(3, 6), () => new InternalRouteRegistration { ReceiverIdentifier = ReceiverIdentities.CreateForMessageHub(), DestinationSocket = new LocalSocket <IMessage>() }); registrations.ForEach(r => internalRoutingTable.AddMessageRoute(r)); var lookupRoute = registrations.First(); var messageHub = lookupRoute.ReceiverIdentifier; var localSocket = lookupRoute.DestinationSocket; // var lookupRequest = new InternalRouteLookupRequest { ReceiverIdentity = messageHub }; var socket = internalRoutingTable.FindRoutes(lookupRequest) .First(); // Assert.AreEqual(localSocket, socket); }