/// <summary> /// 获得签名。 /// </summary> /// <param name="dic">要签名的参数。</param> /// <returns>签名。</returns> public static string GetSign(Dictionary <string, string> dic) { ParamsSigner signer = new ParamsSigner(WeixinApp.DevConfig.PayConfig.PartnerKey) { Params = dic }; return(signer.GetSign()); }
public void GetSignTest() { ParamsSigner paramsSigner = new ParamsSigner("wlitsoft"); Dictionary <string, string> paramsDic = new Dictionary <string, string> { { "p1", "v1" }, { "p2", "v2" } }; paramsSigner.Params = paramsDic; string sign = paramsSigner.GetSign(); Assert.NotNull(sign); Assert.True(sign.Length > 0); }