public async Task Ping() { var data = "ok"; var httpResponse = new HttpResponseMessage { Content = new StringContent(JsonSerializer.Serialize(data)) }; var httpResponseTask = Task.FromResult(httpResponse); var response = new EsiResponse <string>(HttpStatusCode.OK, "ok"); // Ensure that the call to Get returns our mocked response. _mockDataService .Setup(m => m.GetAsync(It.IsAny <Url>())) .Returns(httpResponseTask); _mockResponseFactory .Setup(m => m.Create <string>(It.IsAny <HttpResponseMessage>())) .Returns(response); // Create our endpoint and call ping. var metaEndpoint = new MetaEndpoint( _mockDataService.Object, _mockResponseFactory.Object); var result = await metaEndpoint.Ping(); // Assert that the outcome is what was expected. Assert.AreEqual(response, result); }
private void Init(ApiOptions apiOptions) { Meta = new MetaEndpoint(apiOptions); Alliance = new AllianceEndpoint(apiOptions); Assets = new AssetsEndpoint(apiOptions); Bookmarks = new BookmarksEndpoint(apiOptions); Calendar = new CalendarEndpoint(apiOptions); }
public MuzlanClient(MuzlanClientConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } BaseUri = new Uri(config.Host, UriKind.Absolute); _client = HttpClientFactory.Create(config); _parser = new HtmlParser(); Albums = new AlbumsEndpoint(BaseUri, _client, _parser); Auth = new AuthEndpoint(BaseUri, _client, _parser); Download = new DownloadEndpoint(BaseUri, _client, _parser); Meta = new MetaEndpoint(BaseUri, _client, _parser); Search = new SearchEndpoint(BaseUri, _client, _parser); Sitemap = new SitemapEndpoint(BaseUri, _client, _parser); }