Ejemplo n.º 1
0
        /// <summary>
        /// 获取OpenId和SessionKey的Json数据包
        /// </summary>
        /// <param name="code">客户端发来的code</param>
        /// <returns>Json数据包</returns>
        private string GetOpenIdAndSessionKeyString(string code)
        {
            string temp = "https://api.weixin.qq.com/sns/jscode2session?" +
                          "appid=" + appId
                          + "&secret=" + appSecret
                          + "&js_code=" + code
                          + "&grant_type=authorization_code";

            return(WebHttpHelper.HttpGet(temp));
        }
Ejemplo n.º 2
0
        // ReSharper disable once UnusedParameter.Local
        static void Main(string[] args)
        {
            List <Type> classTypeList = new List <Type>
            {
                typeof(DataTypeConvertHelperTests),
                typeof(DeepCopyHelperTests),
                typeof(EnumberHelperTests),
                typeof(ExcelHelperTests),
                typeof(SecurityTest),
                typeof(ZipHelperTests),
                //typeof(DapperSqlServerTest),
                //typeof(DapperMySqlTest),
                //typeof(DapperSqliteTest),
                typeof(BigIntTest)
            };

            var stopwatch = Stopwatch.StartNew();

            foreach (var type in classTypeList)
            {
                var pgtester = Activator.CreateInstance(type);
                foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
                {
                    var testwatch = Stopwatch.StartNew();
                    Console.Write("Running\t" + method.Name + "\tin FreshCommonUtilityNetTest:");
                    method.Invoke(pgtester, null);
                    Console.WriteLine("\t- OK! \t{0}ms", testwatch.ElapsedMilliseconds);
                }
            }
            stopwatch.Stop();
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            EmitLearn.LearnInfo();
            ExpressionLear.LearnInfo();

            string result = WebHttpHelper.HttpsPost("https://www.ly.com", "key=123"); // key=4da4193e-384b-44d8-8a7f-2dd8b076d784

            result.IsNotEqualTo(string.Empty);

            Console.ReadKey();
        }