Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }