public void ReturnMultiplePackages() { // arrange var repoPackages = new IPackage[] { new MockPackage("A", "1.0"), new MockPackage("AB", "2.0"), new MockPackage("B", "2.0") }; var searchTerm = "A"; var expected = new IPackage[] { new MockPackage("A", "1.0"), new MockPackage("AB", "2.0") }; // act var results = WebNuGetProject.GetPackages(repoPackages.AsQueryable <IPackage>(), searchTerm); // assert Assert.Equal(expected, results.AsEnumerable <IPackage>(), new MockPackage.StubPackageComparer()); }
public void EmptySearchTerm_ReturnAllPackages() { var repoPackages = new IPackage[] { new MockPackage("A", "1.0"), new MockPackage("AB", "2.0") }; var expected = new IPackage[] { new MockPackage("A", "1.0"), new MockPackage("AB", "2.0") }; // act var results = WebNuGetProject.GetPackages(repoPackages.AsQueryable <IPackage>(), null); // assert Assert.Equal(expected, results.AsEnumerable <IPackage>(), new MockPackage.StubPackageComparer()); // act results = WebNuGetProject.GetPackages(repoPackages.AsQueryable <IPackage>(), string.Empty); // assert Assert.Equal(expected, results.AsEnumerable <IPackage>(), new MockPackage.StubPackageComparer()); }