Пример #1
0
        /// <summary>
        /// Executes the given query against the EPIC APi.
        /// </summary>
        /// <param name="pQuery"></param>
        /// <returns></returns>
        public async Task <EpicMetadata[]> QueryArrayAsync(EpicQuery pQuery)
        {
            // Generate the URI with the API KEY
            Uri requestUrl = new Uri(BaseUrl, $"api/{pQuery.ToString()}?api_key={_apiKey}");

            // Make the request to the api and get the result.
            var result = await _client.Get <EpicMetadata[]>(requestUrl);

            // Set th
            // Return the result.
            return(result);
        }
Пример #2
0
        public async Task EPIC_QueryAllEnhanced_CountGreaterThanZero()
        {
            // ARRANGE
            EPICApi   api   = new EPICApi();
            EpicQuery query = new EpicQuery(Archive.Enhanced);

            // ACT
            EpicMetadata[] retVal = await api.QueryArrayAsync(query);

            // ASSERT
            Assert.AreNotEqual(0, retVal.Length);
        }
Пример #3
0
        public async Task EPIC_QueryByDateNatural_CountGreaterThanZero()
        {
            // ARRANGE
            EPICApi   api   = new EPICApi();
            EpicQuery query = new EpicQuery(Archive.Natural);

            query.Date = new System.DateTime(2019, 04, 04);

            // ACT
            EpicMetadata[] retVal = await api.QueryArrayAsync(query);

            // ASSERT
            Assert.AreNotEqual(0, retVal.Length);
        }
Пример #4
0
        public async Task EpicMetadata_GetImageUrlThumbs_IsValidUrl()
        {
            // ARRANGE
            EPICApi   api   = new EPICApi();
            EpicQuery query = new EpicQuery(Archive.Natural);

            query.Date = new DateTime(2019, 04, 04);

            // ACT
            var result = await api.QueryArrayAsync(query);

            #region Assert
            // Get the first element
            EpicMetadata firstElement = result.First();
            // Get the image url
            Uri imageUrl = firstElement.GetImageUrl(api, query, ImageType.Thumbnail);

            // Check if the URL exists.
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.GetAsync(imageUrl);

            Assert.IsTrue(response.IsSuccessStatusCode);
            #endregion
        }