Esempio n. 1
0
        public void FalseValueSerializeTest()
        {
            var obj = new Card_MemberCardData()
            {
                supply_balance = false,
                supply_bonus   = false,
            };
            var str = obj.ToJson();

            Console.WriteLine(str);
            Assert.IsTrue(str.Contains("supply_balance"));
            Assert.IsTrue(str.Contains("supply_bonus"));
        }
Esempio n. 2
0
        public void CreateCardTest()
        {
            //var accessToken = AccessTokenContainer.GetAccessToken("wx4f8e94b7a153ff43");
            string accessToken = "11_jFGzse3a4wGPBq8cCTsKUMGabo2V_dmJVKHKiltmkNmhTSKHv8J6BaJ5nTQ6-eTeNhdh1LNNOcGEkbYelx6DlFaSx9wIcOIlaKGMMJujb9BptSNhWnDq7Vpyb_oQuFT_nYJpp7bOnT5ew1kESKBcACAMEV";

            var data = new Card_MemberCardData()
            {
                base_info         = _BaseInfo,
                supply_bonus      = true,
                supply_balance    = false,
                prerogative       = "123123",
                bind_old_card_url = "www.daidu.com",
                wx_activate       = true
            };
            var result = CardApi.CreateCard(accessToken, data);

            //var data = new Card_GrouponData()
            //    {
            //        base_info = _BaseInfo,
            //        deal_detail = "测试"
            //    };

            //var result = CardApi.CreateCard(accessToken, data);
            //Console.Write(result);
            //Assert.IsNotNull(result);

            //var data3 = new Card_CashData()
            //{
            //    base_info = _BaseInfo,
            //    least_cost = 11,
            //    reduce_cost = 11
            //};
            //var result3 = CardApi.CreateCard(accessToken, data3);
            //Console.WriteLine(result3);
            //Assert.IsNotNull(result3);

            //var data2 = new Card_MeetingTicketData()
            //    {
            //        base_info = _BaseInfo,
            //        //map_url = "http://localhost:18666/images/v2/logo%20.png",
            //        meeting_detail = "测试asdsasdsasdsa"
            //    };

            //var result2 = CardApi.CreateCard(accessToken, data2);
            //Assert.IsNotNull(result2);
            //Console.WriteLine(result2.errmsg);
        }
Esempio n. 3
0
        public IEnumerable <string> Get()
        {
            try
            {
                AccessTokenContainer.Register("wx4f8e94b7a153ff43", "700fcec799b8ff8f1463eb31585eafbc");

                var accessToken = AccessTokenContainer.GetAccessToken("wx4f8e94b7a153ff43");

                Card_GrouponData data1 = new Card_GrouponData()
                {
                    base_info   = _BaseInfo,
                    deal_detail = "测试"
                };

                //string json = JsonConvert.SerializeObject(card_BaseInfoBase);

                var result1 = CardApi.CreateCard(accessToken, data1);

                var data = new Card_MemberCardData()
                {
                    base_info         = _BaseInfo,
                    supply_bonus      = true,
                    supply_balance    = false,
                    prerogative       = "123123",
                    bind_old_card_url = "www.daidu.com",
                    wx_activate       = true
                };

                var result = CardApi.CreateCard(accessToken, data);
            }
            catch (Exception ex)
            {
                throw;
            }



            return(new string[] { "value1", "value2" });
        }
Esempio n. 4
0
        public void ConvertTest()
        {
            try
            {
                var appId       = "";
                var appSecret   = "";
                var accessToken = AccessTokenContainer.TryGetAccessToken(appId, appSecret);

                Card_GrouponData data1 = new Card_GrouponData()
                {
                    base_info   = _BaseInfo,
                    deal_detail = "测试"
                };

                //这个位置报错
                var result1 = CardApi.CreateCard(accessToken, data1);

                var data = new Card_MemberCardData()
                {
                    base_info         = _BaseInfo,
                    supply_bonus      = true,
                    supply_balance    = false,
                    prerogative       = "123123",
                    bind_old_card_url = "www.senparc.com",
                    wx_activate       = true
                };

                var result = CardApi.CreateCard(accessToken, data);
                System.Console.WriteLine(result.ToJson());
            }
            catch (Exception ex)
            {
                //这里如果刨除微信层面的异常,说明之前发送阶段已经测试通过
                Assert.IsInstanceOfType(ex, typeof(WeixinException));
            }
        }