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 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); }