public void TestAddingActorsHandlingTheSameMessageTwice_ThowsDuplicatedKeyException() { var actorHandlersMap = new ActorHandlerMap(); var actor = new EchoActor(); actorHandlersMap.Add(actor); Assert.Throws<DuplicatedKeyException>(() => { actorHandlersMap.Add(actor); }); }
public void TestGettingHandlerForNonRegisteredMessageIdentifier_ThrowsKeyNotFoundException() { var actorHandlersMap = new ActorHandlerMap(); var actor = new EchoActor(); actorHandlersMap.Add(actor); Assert.Throws<KeyNotFoundException>(()=> actorHandlersMap.Get(new MessageIdentifier(Message.CurrentVersion, ExceptionMessage.MessageIdentity))); }
public void TestGetRegisteredIdentifiers_ReturnsAllRegisteredMessageHandlers() { var actorHandlersMap = new ActorHandlerMap(); var actor = new EchoActor(); actorHandlersMap.Add(actor); var identifiers = actorHandlersMap.GetMessageHandlerIdentifiers(); Assert.AreEqual(2, identifiers.Count()); CollectionAssert.Contains(identifiers, new MessageIdentifier(Message.CurrentVersion, SimpleMessage.MessageIdentity)); CollectionAssert.Contains(identifiers, new MessageIdentifier(Message.CurrentVersion, AsyncMessage.MessageIdentity)); }
public void Setup() { messageTracer = new Mock<IMessageTracer>(); loggerMock = new Mock<ILogger>(); logger = new Logger("default"); actorHandlersMap = new ActorHandlerMap(); actorHostSocketFactory = new ActorHostSocketFactory(); socketFactory = new Mock<ISocketFactory>(); socketFactory.Setup(m => m.CreateDealerSocket()).Returns(actorHostSocketFactory.CreateSocket); routerConfiguration = new RouterConfiguration { ScaleOutAddress = new SocketEndpoint(new Uri(localhost), SocketIdentifier.CreateIdentity()), RouterAddress = new SocketEndpoint(new Uri(localhost), SocketIdentifier.CreateIdentity()) }; }