public FindPackagesById ( string packageId ) : IEnumerable |
||
packageId | string | |
리턴 | IEnumerable |
public void ServerPackageRepositoryFindPackageById() { // Arrange var mockProjectSystem = new Mock<MockProjectSystem>() { CallBase = true }; _packageStreams = new Dictionary<string, MemoryStream>(); AddPackage(mockProjectSystem, "test", "1.0"); AddPackage(mockProjectSystem, "test2", "1.0"); AddPackage(mockProjectSystem, "test3", "1.0-alpha"); AddPackage(mockProjectSystem, "test4", "2.0"); var serverRepository = new ServerPackageRepository(new DefaultPackagePathResolver(mockProjectSystem.Object), mockProjectSystem.Object); serverRepository.HashProvider = GetHashProvider(); // Act var valid = serverRepository.FindPackagesById("test"); var invalid = serverRepository.FindPackagesById("bad"); // Assert Assert.Equal("test", valid.First().Id); Assert.Equal(0, invalid.Count()); }
public void ServerPackageRepositoryEmptyRepo() { // Arrange var mockProjectSystem = new Mock<MockProjectSystem>() { CallBase = true }; _packageStreams = new Dictionary<string, MemoryStream>(); var serverRepository = new ServerPackageRepository(new DefaultPackagePathResolver(mockProjectSystem.Object), mockProjectSystem.Object); serverRepository.HashProvider = GetHashProvider(); var package = CreatePackage("test", "1.0"); // Act var findPackage = serverRepository.FindPackage("test", new SemanticVersion("1.0")); var findPackagesById = serverRepository.FindPackagesById("test"); var getMetadataPackage = serverRepository.GetMetadataPackage(package); var getPackages = serverRepository.GetPackages().ToList(); var getPackagesWithDerivedData = serverRepository.GetPackagesWithDerivedData().ToList(); var getUpdates = serverRepository.GetUpdates(Enumerable.Empty<IPackageName>(), true, true, Enumerable.Empty<FrameworkName>(), Enumerable.Empty<IVersionSpec>()); var search = serverRepository.Search("test", true).ToList(); var source = serverRepository.Source; // Assert Assert.Null(findPackage); Assert.Empty(findPackagesById); Assert.Null(getMetadataPackage); Assert.Empty(getPackages); Assert.Null(getMetadataPackage); Assert.Empty(getPackagesWithDerivedData); Assert.Empty(getUpdates); Assert.Empty(search); Assert.NotEmpty(source); }