This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from AnthonySteele/test-the-api-package-lookup
Test the api package lookup
- Loading branch information
Showing
2 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NuKeeper.NuGet.Api; | ||
using NUnit.Framework; | ||
|
||
namespace NuKeeper.Tests.Nuget.Api | ||
{ | ||
[TestFixture] | ||
public class ApiPackageLookupTests | ||
{ | ||
[Test] | ||
public async Task UnknownPackageName_ShouldNotReturnResult() | ||
{ | ||
IApiPackageLookup lookup = new ApiPackageLookup(); | ||
|
||
var package = await lookup.LookupLatest(Guid.NewGuid().ToString()); | ||
|
||
Assert.That(package, Is.Null); | ||
} | ||
|
||
[Test] | ||
public async Task WellKnownPackageName_ShouldReturnResult() | ||
{ | ||
IApiPackageLookup lookup = new ApiPackageLookup(); | ||
|
||
var package = await lookup.LookupLatest("Newtonsoft.Json"); | ||
|
||
Assert.That(package, Is.Not.Null); | ||
Assert.That(package.Identity, Is.Not.Null); | ||
Assert.That(package.Identity.Id, Is.EqualTo("Newtonsoft.Json")); | ||
} | ||
|
||
[Test] | ||
public async Task AmbigousPackageName_ShouldReturnCorrectResult() | ||
{ | ||
IApiPackageLookup lookup = new ApiPackageLookup(); | ||
|
||
var package = await lookup.LookupLatest("AWSSDK"); | ||
|
||
Assert.That(package, Is.Not.Null); | ||
Assert.That(package.Identity, Is.Not.Null); | ||
Assert.That(package.Identity.Id, Is.EqualTo("AWSSDK")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters