public async Task SendRequestTest() { var storage = new MemoryStorage(); var mockClient = new WeChatClient(settings, storage); await mockClient.SendHttpRequestAsync(HttpMethod.Get, "https://dev.botframework.com"); await mockClient.SendHttpRequestAsync(HttpMethod.Get, "https://dev.botframework.com", "mockdata", "testToken"); }
public async Task SendRequestTimeoutTest() { var storage = new MemoryStorage(); var mockClient = new WeChatClient(settings, storage); await mockClient.SendHttpRequestAsync(HttpMethod.Get, "https://dev.botframework.com", timeout : 1000); Thread.Sleep(1500); }
public async Task ClientDisposeTest() { var storage = new MemoryStorage(); var mockClient = new WeChatClient(settings, storage); await mockClient.SendHttpRequestAsync(HttpMethod.Get, "https://dev.botframework.com"); mockClient.Dispose(); }
private async void ShareWindow_WeChatShareClick(object sender, RoutedEventArgs e) { var cache = ImageCache.CreateInstance(); var uri = await cache.GetImageSourceFromUrlAsync(story.Images[0]); var file = await StorageFile.GetFileFromApplicationUriAsync(uri); using (var stream = await file.OpenReadAsync()) { var pic = new byte[stream.Size]; await stream.AsStream().ReadAsync(pic, 0, pic.Length); WeChatClient client = new WeChatClient(); client.ShareLink(shareUrl, title, $"{title}(分享自 @知乎日报 App)", pic); } }
public WXRobot(WeChatClient wxServices) { this.wxServices = wxServices; }