コード例 #1
0
        public void TestAddingActorsHandlingTheSameMessageTwice_ThowsDuplicatedKeyException()
        {
            var actorHandlersMap = new ActorHandlerMap();
            var actor = new EchoActor();

            actorHandlersMap.Add(actor);
            Assert.Throws<DuplicatedKeyException>(() => { actorHandlersMap.Add(actor); });
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
        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));

        }
コード例 #4
0
ファイル: ActorHostTests.cs プロジェクト: gitter-badger/kino
 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())
                           };
 }