Inheritance: IPackageRepositoryBrowser
        public void RepositoryConfigurations_ReturnsAllConfigurationsProvidedByTheSourceRepositoryProvider()
        {
            // Arrange
            var sourceRepositoryConfiguration1 = new SourceRepositoryConfiguration { Name = "Test Repo 1", Url = new Uri("https://example1.org/api/v2/") };
            var sourceRepositoryConfiguration2 = new SourceRepositoryConfiguration { Name = "Test Repo 2", Url = new Uri("https://example2.org/api/v2/") };

            var repositoryConfigurations = new List<SourceRepositoryConfiguration> { sourceRepositoryConfiguration1, sourceRepositoryConfiguration2 };

            var sourceRepositoryProviderMock = new Mock<ISourceRepositoryProvider>();
            sourceRepositoryProviderMock.Setup(r => r.GetRepositoryConfigurations()).Returns(repositoryConfigurations);

            var packageRepositoryFactoryMock = new Mock<IPackageRepositoryFactory>();
            packageRepositoryFactoryMock.Setup(f => f.CreateRepository(It.IsAny<string>())).Returns(new Mock<IPackageRepository>().Object);

            // Act
            var packageRepositoryBrowser = new PackageRepositoryBrowser(sourceRepositoryProviderMock.Object, packageRepositoryFactoryMock.Object);

            // Assert
            Assert.AreEqual(repositoryConfigurations, packageRepositoryBrowser.RepositoryConfigurations.ToList());
        }
        public void FindPackage_PackageIdParameterIsNotValid_ArgumentExceptionIsThrown(string packageId)
        {
            // Arrange
            var sourceRepositoryProviderMock = new Mock<ISourceRepositoryProvider>();
            sourceRepositoryProviderMock.Setup(r => r.GetRepositoryConfigurations()).Returns(new List<SourceRepositoryConfiguration>());

            var packageRepositoryFactoryMock = new Mock<IPackageRepositoryFactory>();
            packageRepositoryFactoryMock.Setup(f => f.CreateRepository(It.IsAny<string>())).Returns(new Mock<IPackageRepository>().Object);

            var packageRepositoryBrowser = new PackageRepositoryBrowser(sourceRepositoryProviderMock.Object, packageRepositoryFactoryMock.Object);

            // Act
            packageRepositoryBrowser.FindPackage(packageId);
        }
        public void RepositoryConfigurations_ISourceRepositoryProvider_GetRepositoryConfigurations_ReturnedNoConfigurations_ResultIsEmptyList()
        {
            // Arrange
            var sourceRepositoryProviderMock = new Mock<ISourceRepositoryProvider>();
            sourceRepositoryProviderMock.Setup(r => r.GetRepositoryConfigurations()).Returns(new List<SourceRepositoryConfiguration>());

            var packageRepositoryFactoryMock = new Mock<IPackageRepositoryFactory>();
            packageRepositoryFactoryMock.Setup(f => f.CreateRepository(It.IsAny<string>())).Returns(new Mock<IPackageRepository>().Object);

            // Act
            var packageRepositoryBrowser = new PackageRepositoryBrowser(sourceRepositoryProviderMock.Object, packageRepositoryFactoryMock.Object);

            // Assert
            Assert.AreEqual(0, packageRepositoryBrowser.RepositoryConfigurations.Count());
        }
        public void FindPackage_PackageIdIsValid_NoRepositoriesAreConfigured_ResultIsNull()
        {
            // Arrange
            var sourceRepositoryProviderMock = new Mock<ISourceRepositoryProvider>();
            sourceRepositoryProviderMock.Setup(r => r.GetRepositoryConfigurations()).Returns(new List<SourceRepositoryConfiguration>());

            var packageRepositoryFactoryMock = new Mock<IPackageRepositoryFactory>();
            packageRepositoryFactoryMock.Setup(f => f.CreateRepository(It.IsAny<string>())).Returns(new Mock<IPackageRepository>().Object);

            var packageRepositoryBrowser = new PackageRepositoryBrowser(sourceRepositoryProviderMock.Object, packageRepositoryFactoryMock.Object);

            // Act
            IPackage result = packageRepositoryBrowser.FindPackage("package");

            // Assert
            Assert.IsNull(result);
        }