Beispiel #1
0
        public PutTests()
        {
            var sessionFactory = Substitute.For <ISessionFactory>();

            _session    = sessionFactory.CreateCommandSession();
            _controller = new VideosController(sessionFactory);
        }
Beispiel #2
0
        public override void OnExecute(object session)
        {
#if COREFX
            Task.Run(async() => {
                //调用实现,并返回结果
                var replyCommand = await ExecuteRequestAsync(session);
                RpcReply reply   = new RpcReply()
                {
                    Request      = this,
                    ReplyCommand = replyCommand
                };
                ICommandSession commandSession = (ICommandSession)session;
                commandSession.Send(reply);
            });
#else
            ExecuteRequestAsync(session, replyCommand => {
                RpcReply reply = new RpcReply()
                {
                    Request      = this,
                    ReplyCommand = replyCommand
                };
                ICommandSession commandSession = (ICommandSession)session;
                commandSession.Send(reply);
            });
#endif
        }