public void IsLatestVersionBuildOK(string product, string singleOs, string singleArch) { HcReleaseData testedInstance = hcData.Where(data => data.Name.Equals(product)).SingleOrDefault(); HcReleasesBuild build = testedInstance.GetBuild(singleOs, singleArch); // test if a build was returned for the latest version and os/arch combination Assert.NotNull(build); // test if the build url matches the expected pattern Assert.Matches(hcLinkPattern, build.Url); }
public void IsPopulatingCorrectly_GetHcProductReleasesData(string product) { HcReleaseData testedInstance = hcData.Where(data => data.Name.Equals(product)).SingleOrDefault(); // check if the correct product was received Assert.Equal(testedInstance.Name, product); // Check if the versions list is empty Assert.True(testedInstance.Versions.Count > 0); // check that a version contains builds Assert.True(testedInstance.Versions.First().Value.Builds.Count > 0); }
/// <summary> /// An overload of GetHcProductReleasesData where the HttpClient can be passed /// <summary> public static async Task <HcReleaseData> GetHcProductReleasesData(string product, HttpClient webClient) { if (product == null || webClient == null) { throw new ArgumentNullException(); } string baseUrl = String.Format(HcReleasesUrlPattern, product); HcReleaseData result = null; HttpResponseMessage response = await webClient.GetAsync(baseUrl); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); result = JsonConvert.DeserializeObject <HcReleaseData>(responseBody); return(result); }