public async Task LatestRelease_TipIsReleased() { _mockHttp.When("https://azuresearch-usnc.nuget.org/query?q=packageid:L10NSharp&prerelease=true") .Respond("application/json", responseJsonBegin + "4.0.2" + responseJsonMiddle + allVersions + responseJsonEnd); NuGetPackage.HttpClient = _mockHttp.ToHttpClient(); var sut = new NuGetPackage("L10NSharp"); await sut.GetVersions(); Assert.That(sut.LatestRelease, Is.EqualTo(SemanticVersion.Parse("4.0.2"))); }
public async Task GetVersions() { _mockHttp.When("https://azuresearch-usnc.nuget.org/query?q=packageid:L10NSharp&prerelease=true") .Respond("application/json", responseJsonBegin + "4.0.2" + responseJsonMiddle + allVersions + responseJsonEnd); NuGetPackage.HttpClient = _mockHttp.ToHttpClient(); var sut = new NuGetPackage("L10NSharp"); Assert.That(await sut.GetVersions(), Is.EquivalentTo(new [] { SemanticVersion.Parse("4.0.0"), SemanticVersion.Parse("4.0.1"), SemanticVersion.Parse("4.0.2-beta0003"), SemanticVersion.Parse("4.0.2") })); }
public async Task Maximum_Default_IsLatestRelease() { _mockHttp.When("https://azuresearch-usnc.nuget.org/query?q=packageid:L10NSharp&prerelease=true") .Respond("application/json", responseJsonBegin + "4.0.3-beta0003" + responseJsonMiddle + @" { ""version"": ""4.0.2"", ""downloads"": 28, ""@id"": ""https://api.nuget.org/v3/registration3/l10nsharp/4.0.2.json"" }, { ""version"": ""4.0.3-beta0003"", ""downloads"": 0, ""@id"": ""https://api.nuget.org/v3/registration3/l10nsharp/4.0.3-beta0003.json"" }" + responseJsonEnd); NuGetPackage.HttpClient = _mockHttp.ToHttpClient(); var sut = new NuGetPackage("L10NSharp", max: ""); await sut.GetVersions(); Assert.That(sut.Maximum, Is.EqualTo(SemanticVersion.Parse("4.0.2"))); }