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); }
public void InitConfigTesst() { DevConfiguration devConfig = WeixinApp.DevConfig; Assert.NotNull(devConfig); Assert.True(devConfig.AppID.Length > 0); Assert.True(devConfig.AppSecret.Length > 0); }
public void BuildByAppSettingsTest() { DevConfiguration devConfig = DevConfigurationBuilder.BuildByAppSettings(); Assert.NotNull(devConfig); Assert.True(devConfig.AppID.Length > 0); Assert.True(devConfig.AppSecret.Length > 0); }
public void BuildByJsonFileTest() { DevConfiguration devConfig = DevConfigurationBuilder.BuildByJsonFile("./Conf/WeixinSDKDev.json"); Assert.NotNull(devConfig); Assert.True(devConfig.AppID.Length > 0); Assert.True(devConfig.AppSecret.Length > 0); }
/// <summary> /// 设置微信开发配置 <see cref="DevConfiguration"/>。 /// </summary> /// <param name="appBuilder">应用构造。</param> /// <param name="config">一个 <see cref="DevConfiguration"/> 对象。</param> /// <returns>应用 构造 静态扩展。</returns> public static AppBuilder SetWeixinDevConfig(this AppBuilder appBuilder, DevConfiguration config) { #region 参数校验 if (config == null) { throw new ObjectNullException(nameof(config)); } #endregion WeixinApp.DevConfig = config; return(appBuilder); }