Exemple #1
0
        public void UploadImageTest()
        {
            var url = _storeService.UploadImage(ApiTestHelper.GetJpgBytes());

            Assert.NotNull(url);
            Assert.True(url.StartsWith("http://"));
        }
Exemple #2
0
        public void CreateTest()
        {
            var url = _storeService.UploadImage(ApiTestHelper.GetJpgBytes());

            _storeService.Create(new CreateStoreModel
            {
                Address    = "西洪路528号",
                AvgPrice   = 50,
                BranchName = "大泽",
                Categories = new Collection <string> {
                    "公司企业", "企业/工厂"
                },
                City          = "福州市",
                CustomStoreId = "1000",
                District      = "鼓楼区",
                EndTime       = new TimeSpan(18, 0, 0),
                Introduction  = "大泽技术",
                Latitude      = 25.097486,
                Longitude     = 115.32375,
                Name          = "众事达",
                PhotoList     = new[] { url },
                Province      = "福建省",
                Recommend     = "雨后春笋",
                Special       = "免费wifi",
                StartTime     = new TimeSpan(8, 30, 0),
                TelePhone     = "0591-63323934"
            });
        }
Exemple #3
0
        public void AddJpgTest()
        {
            var result = _materialService.AddOther(ApiTestHelper.GetJpgBytes());

            Assert.NotNull(result.MediaId);
            Assert.True(Uri.IsWellFormedUriString(result.Url, UriKind.Absolute));
        }
Exemple #4
0
        public void AddNewsTest()
        {
            var result = _materialService.AddOther(ApiTestHelper.GetJpgBytes());

            _materialService.AddNews(new[]
            {
                new NewsArticleModel
                {
                    Author              = "author",
                    Content             = "content",
                    Description         = "description",
                    IsShowConverPicture = true,
                    ThumbnailsMediaId   = result.MediaId,
                    Title = "标题1",
                    Url   = "http://cn.bing.com"
                },
                new NewsArticleModel
                {
                    Author              = "author2",
                    Content             = "content2",
                    Description         = "description2",
                    IsShowConverPicture = true,
                    ThumbnailsMediaId   = result.MediaId,
                    Title = "标题2",
                    Url   = "http://cn.bing.com"
                },
            });
        }
Exemple #5
0
        public void SendNewsByGroupTest()
        {
            var result = _foreverMaterialService.AddOther(ApiTestHelper.GetJpgBytes());
            var newsId = _foreverMaterialService.AddNews(new[]
            {
                new NewsArticleModel
                {
                    Author              = "author",
                    Content             = "content",
                    Description         = "description",
                    IsShowConverPicture = true,
                    ThumbnailsMediaId   = result.MediaId,
                    Title = "标题1",
                    Url   = "http://cn.bing.com"
                },
                new NewsArticleModel
                {
                    Author              = "author2",
                    Content             = "content2",
                    Description         = "description2",
                    IsShowConverPicture = true,
                    ThumbnailsMediaId   = result.MediaId,
                    Title = "标题2",
                    Url   = "http://cn.bing.com"
                }
            });

            _groupMessageService.SendByGroup(new GroupFilter(), new GroupMessageNews
            {
                MediaId = newsId
            });
        }
        public void AddJpgTemporaryTest()
        {
            var result = _materialService.AddTemporary(ApiTestHelper.GetJpgBytes(), MaterialType.Image);

            Assert.Equal(MaterialType.Image, result.Type);
            Assert.NotNull(result.MediaId);
            Assert.Equal(DateTime.Now.Year, result.CreateTime.Year);
        }
Exemple #7
0
        public void GetOtherTest()
        {
            var result = _materialService.AddOther(ApiTestHelper.GetJpgBytes());
            var data   = _materialService.GetOther(result.MediaId);

            Assert.NotNull(data);
            Assert.True(data.Length > 0);
        }
        public void SetAccountHeadPicture()
        {
            _customServiceService.AddAccount("test@chunsun_cc", "E10ADC3949BA59ABBE56E057F20F883E", "test");
            _customServiceService.SetAccountHeadPicture("test@chunsun_cc", ApiTestHelper.GetJpgBytes());
            var headPictureUrl = _customServiceService.GetAccounts().First(i => i.Account == "test@chunsun_cc").HeadPictureUrl;

            Assert.IsNotNull(headPictureUrl);
        }
Exemple #9
0
        public void SendImageMessageTest()
        {
            var result = _temporaryMaterialService.AddTemporary(ApiTestHelper.GetJpgBytes(), MaterialType.Image);

            _customServiceMessageService.Send(new CustomServiceMessageImage(OpenId)
            {
                MediaId = result.MediaId
            });
        }
        public void GetTemporaryTest()
        {
            var result = _materialService.AddTemporary(ApiTestHelper.GetJpgBytes(), MaterialType.Image);
            var model  = _materialService.GetTemporary(result.MediaId);

            Assert.Equal("image/jpeg", model.ContentType);
            Assert.NotNull(model.FileName);
            Assert.True(model.Data.Length > 0);
        }
Exemple #11
0
        public void SendVideoMessageTest()
        {
            var thumbnailsMedia = _temporaryMaterialService.AddTemporary(ApiTestHelper.GetJpgBytes(), MaterialType.Thumb);
            var result          = _temporaryMaterialService.AddTemporary(ApiTestHelper.GetMp4Bytes(), MaterialType.Video);

            _customServiceMessageService.Send(new CustomServiceMessageVideo(OpenId)
            {
                Description       = "视频说明",
                MediaId           = result.MediaId,
                ThumbnailsMediaId = thumbnailsMedia.MediaId,
                Title             = "视频标题"
            });
        }
Exemple #12
0
        public void SendMusicMessageTest()
        {
            var result = _temporaryMaterialService.AddTemporary(ApiTestHelper.GetJpgBytes(), MaterialType.Thumb);

            _customServiceMessageService.Send(new CustomServiceMessageMusic(OpenId)
            {
                Description       = "董贞",
                HqMusicUrl        = ApiTestHelper.HqMusicUrl,
                MusicUrl          = ApiTestHelper.MusicUrl,
                ThumbnailsMediaId = result.MediaId,
                Title             = "星辰泪"
            });
        }
Exemple #13
0
        public void DeleteTest()
        {
            var result = _materialService.AddOther(ApiTestHelper.GetJpgBytes());

            _materialService.Delete(result.MediaId);
            try
            {
                _materialService.GetOther(result.MediaId);
                Assert.True(false);
            }
            catch
            {
            }
        }
Exemple #14
0
        public void UploadLogoTest()
        {
            var url = _cardService.UploadLogo(ApiTestHelper.GetJpgBytes());

            Assert.True(Uri.IsWellFormedUriString(url, UriKind.Absolute));
        }
Exemple #15
0
        public void SendImageByGroupTest()
        {
            var result = _foreverMaterialService.AddOther(ApiTestHelper.GetJpgBytes());

            _groupMessageService.SendByGroup(new GroupFilter(), new GroupMessageImage(result.MediaId));
        }