﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WX.Model.ApiRequests;
using WX.Model.ApiResponses;
using Xunit;

namespace FrameworkCoreTest.Api
{
    public class GetCurrentSelfmenuInfoTest : MockPostApiBaseTest<GetCurrentSelfmenuInfoRequest, GetCurrentSelfmenuInfoResponse>
    {
        [Fact]
        public void GetCurrentSelfmenuTest()
        {
            MockSetup(false);
            var response = mock_client.Object.Execute(Request);
            Assert.IsType<GetCurrentSelfmenuInfoResponse>(response);
            //Console.WriteLine(response.IsError);
        }

        protected override GetCurrentSelfmenuInfoRequest InitRequestObject()
        {
            return new GetCurrentSelfmenuInfoRequest
            {
                AccessToken = "123"
            };
        }

        protected override string GetReturnResult(bool errResult)
        {
            if (errResult) return s_errmsg;

//            return @"{ 
//               ""is_menu_open"": 1, 
//               ""selfmenu_info"": { 
//                   ""button"": [ 
//                       { 
//                           ""type"": ""click"", 
//                           ""name"": ""今日歌曲"", 
//                           ""key"": ""V1001_TODAY_MUSIC""
//                       }, 
//                       { 
//                           ""name"": ""菜单"", 
//                           ""sub_button"": { 
//                               ""list"": [ 
//                                   { 
//                                       ""type"": ""view"", 
//                                       ""name"": ""搜索"", 
//                                       ""url"": ""http://www.soso.com/""
//                                   }, 
//                                   { 
//                                       ""type"": ""view"", 
//                                       ""name"": ""视频"", 
//                                       ""url"": ""http://v.qq.com/""
//                                   }, 
//                                   { 
//                                       ""type"": ""click"", 
//                                       ""name"": ""赞一下我们"", 
//                                       ""key"": ""V1001_GOOD""
//                                   }
//                               ]
//                           }
//                       }
//                   ]
//               }
//            }";
            return @"{ 
               ""is_menu_open"": 1, 
               ""selfmenu_info"": { 
                   ""button"": [ 
                       { 
                           ""name"": ""button"", 
                           ""sub_button"": { 
                               ""list"": [ 
                                   { 
                                       ""type"": ""view"", 
                                       ""name"": ""view_url"", 
                                       ""url"": ""http://www.qq.com""
                                   }, 
                                   { 
                                       ""type"": ""news"", 
                                       ""name"": ""news"", 
                                       ""news_info"": { 
                                           ""list"": [ 
                                               { 
                                                   ""title"": ""MULTI_NEWS"", 
                                                   ""author"": ""JIMZHENG"", 
                                                   ""digest"": ""text"", 
                                                   ""show_cover"": 0, 
                                                   ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLvhTcm9sDA/0"", 
                                                   ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd"", 
                                                   ""source_url"": """"
                                               }, 
                                               { 
                                                   ""title"": ""MULTI_NEWS1"", 
                                                   ""author"": ""JIMZHENG"", 
                                                   ""digest"": ""MULTI_NEWS1"", 
                                                   ""show_cover"": 1, 
                                                   ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKnmnpXYgWmQD5gXUrEApIYBCgvh2yHsu3ic3anDUGtUCHwjiaEC5bicd7A/0"", 
                                                   ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=2&sn=8226843afb14ecdecb08d9ce46bc1d37#rd"", 
                                                   ""source_url"": """"
                                               }
                                           ]
                                       }
                                   },
                                   {
                                       ""type"": ""video"", 
                                       ""name"": ""video"", 
                                       ""value"": ""http://61.182.130.30/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=77A42D0C2015FBB0A3653D29C571B5F4BBF1D243FBEF17F09C24FF1F2F22E30881BD350E360BC53F&sha=0&save=1""
                                   }, 
                                   { 
                                       ""type"": ""voice"",
                                       ""name"": ""voice"", 
                                       ""value"": ""nTXe3aghlQ4XYHa0AQPWiQQbFW9RVtaYTLPC1PCQx11qc9UB6CiUPFjdkeEtJicn""
                                   }
                               ]
                           }
                       }, 
                       { 
                           ""type"": ""text"", 
                           ""name"": ""text"", 
                           ""value"": ""This is text!""
                       }, 
                       { 
                           ""type"": ""img"", 
                           ""name"": ""photo"", 
                           ""value"": ""ax5Whs5dsoomJLEppAvftBUuH7CgXCZGFbFJifmbUjnQk_ierMHY99Y5d2Cv14RD""
                       }
                   ]
               }
            }";
        }
    }
}
