Exemple #1
0
        public void CreateWxaQrCodeTest()
        {
            var dt1 = DateTime.Now;

            using (var ms = new MemoryStream())
            {
                var result = WxAppApi.CreateWxQrCode(base._appId, ms, "pages/websocket", 100);
                Assert.AreEqual(ReturnCode.请求成功, result.errcode);

                ms.Seek(0, SeekOrigin.Begin);
                //储存图片

                var filePath = "../../Config/qr.jpg";
                File.Delete(filePath);
                using (var fs = new FileStream(filePath, FileMode.CreateNew))
                {
                    ms.CopyTo(fs);
                    fs.Flush();
                }
                Assert.IsTrue(File.Exists(filePath));
            }

            var dt2 = DateTime.Now;

            Console.WriteLine("执行时间:{0}ms", (dt2 - dt1).TotalMilliseconds);
        }
Exemple #2
0
        public void CreateWxaQrCodeTest2()
        {
            var dt1      = DateTime.Now;
            var filePath = "../../Config/qr2.jpg";
            var result   = WxAppApi.CreateWxQrCode(base._appId, filePath, "pages/websocket", 100);
            var dt2      = DateTime.Now;

            Console.WriteLine("执行时间:{0}ms", (dt2 - dt1).TotalMilliseconds);
        }