public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_ShouldNotInclude() { // Arrange var mock = new MockGenerator() .MockOpenExistingPackage() .MockPackageId(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.GetPackageMetadataFromPath(mock.NupkgFile, (p) => { return(false); }); // Assert Assert.IsNull(returnedPackageMetadata); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_LibToolsAndContent() { // Arrange var mock = new MockGenerator() .MockOpenExistingPackage() .MockToolsAndContentDlls(); PackageMetadata expectedPackageMetadata = mock.GetExpectedPackageMetadata(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.GetPackageMetadataFromPath(mock.NupkgFile, null); // Assert Assert.IsTrue(expectedPackageMetadata.Equals(returnedPackageMetadata)); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_DiscoverPackages_NupkgNotFound() { // Arrange var mock = new MockGenerator() .MockGetPackages() .MockNupkgNotFound(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.DiscoverPackages(new[] { mock.SourceDirectory }, new HashSet <string>(), newOnly: false, lastIndexModifiedTime: DateTime.Now, cancellationToken: CancellationToken.None, shouldIncludeFunc: null); // Assert Assert.IsFalse(returnedPackageMetadata.Any()); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_DiscoverPackages_ValidPackage() { // Arrange var mock = new MockGenerator() .MockGetPackages() .MockOpenExistingPackage() .MockPackageInfo() .MockLibDllInTheSameFolderAsNupkg(); PackageMetadata expectedPackageMetadata = mock.GetExpectedPackageMetadata(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.DiscoverPackages(new[] { mock.SourceDirectory }, new HashSet <string>(), newOnly: false, lastIndexModifiedTime: DateTime.Now, cancellationToken: CancellationToken.None, shouldIncludeFunc: null); // Assert Assert.IsTrue(expectedPackageMetadata.Equals(returnedPackageMetadata.First())); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_DiscoverPackages_NupkgNotFound() { // Arrange var mock = new MockGenerator() .MockGetPackages() .MockNupkgNotFound(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.DiscoverPackages(new[] { mock.SourceDirectory }, new HashSet<string>(), newOnly: false, lastIndexModifiedTime: DateTime.Now, cancellationToken: CancellationToken.None, shouldIncludeFunc: null); // Assert Assert.IsFalse(returnedPackageMetadata.Any()); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_DiscoverPackages_ValidPackage() { // Arrange var mock = new MockGenerator() .MockGetPackages() .MockOpenExistingPackage() .MockPackageInfo() .MockLibDllInTheSameFolderAsNupkg(); PackageMetadata expectedPackageMetadata = mock.GetExpectedPackageMetadata(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.DiscoverPackages(new[] { mock.SourceDirectory }, new HashSet<string>(), newOnly: false, lastIndexModifiedTime: DateTime.Now, cancellationToken: CancellationToken.None, shouldIncludeFunc: null); // Assert Assert.IsTrue(expectedPackageMetadata.Equals(returnedPackageMetadata.First())); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_LibExplicitReferences() { // Arrange var mock = new MockGenerator() .MockOpenExistingPackage() .MockPackageInfo() .MockLibExplicitReferencesDll(); PackageMetadata expectedPackageMetadata = mock.GetExpectedPackageMetadata(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.GetPackageMetadataFromPath(mock.NupkgFile, null); // Assert Assert.IsTrue(expectedPackageMetadata.Equals(returnedPackageMetadata)); mock.VerifyAll(); }
public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_ShouldNotInclude() { // Arrange var mock = new MockGenerator() .MockOpenExistingPackage() .MockPackageId(); // Act var loader = new NupkgLocalPackageLoader(mock.FileSystem.Object, mock.NugetHelper.Object); var returnedPackageMetadata = loader.GetPackageMetadataFromPath(mock.NupkgFile, (p) => { return false; } ); // Assert Assert.IsNull(returnedPackageMetadata); mock.VerifyAll(); }