Exemple #1
0
        public WeixinMessageHandlerTest()
        {
            //设置日志。
            App.Builder.SetLog4NetLoggerByXmlConfig("./Conf/log4net.conf");

            DevConfiguration devConfig = new DevConfiguration()
            {
                AppID          = "wx5823bf96d3bd56c7",
                Token          = "QDG6eK",
                EncodingAESKey = "jWmYm7qr5nMoAUwZRjGtBxmz3KA1tkAj3ykkR6q2B2C"
            };

            DebugTokenService tokenService = new DebugTokenService()
            {
                Token = "xxxxxxxxx"
            };

            //设置微信SDK相关。
            App.Builder
            .SetWeixinLogger("WeixinSDKLog")
            .SetWeixinDevConfig(devConfig)
            .SetWeixinTokenService(tokenService);

            MessageProcessConfiguration pc = new MessageProcessConfiguration();

            pc.MessageList.Add(new MessageConfiguration <RequestTextMessageProcessFake>(RequestMsgType.Text));

            App.Builder
            .SetWeixinMessageConfig(pc);
        }
Exemple #2
0
        public void GetTokenTest()
        {
            DebugTokenService tokenService = new DebugTokenService()
            {
                Token = "token11111"
            };

            string token = tokenService.GetToken();

            Assert.NotNull(token);
            Assert.Equal("token11111", token);
        }