public ActorMethodDispatcherMap(ActorTypeInformation actorTypeInformation)
        {
            this.map = new Dictionary <int, ActorMethodDispatcherBase>();

            foreach (var actorInterfaceType in actorTypeInformation.InterfaceTypes)
            {
                var methodDispatcher = ActorCodeBuilder.GetOrCreateMethodDispatcher(actorInterfaceType);
                this.map.Add(methodDispatcher.InterfaceId, methodDispatcher);
            }
        }
Пример #2
0
        public async Task ActorCodeBuilder_BuildDispatcher()
        {
            var host = ActorHost.CreateForTest <TestActor>();

            var dispatcher = ActorCodeBuilder.GetOrCreateMethodDispatcher(typeof(ITestActor));
            var methodId   = MethodDescription.Create("test", typeof(ITestActor).GetMethod("GetCountAsync"), true).Id;

            var impl     = new TestActor(host);
            var request  = new ActorRequestMessageBody(0);
            var response = new WrappedRequestMessageFactory();

            var body = (WrappedMessage)await dispatcher.DispatchAsync(impl, methodId, request, response, default);

            dynamic bodyValue = body.Value;

            Assert.Equal(5, (int)bodyValue.retVal);
        }