示例#1
0
        public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_NupkgDoesNotExist()
        {
            // Arrange
            var mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict);

            // Act
            var loader = new NupkgLocalPackageLoader(mockFileSystem.Object, null);
            var returnedPackageMetadata = loader.GetPackageMetadataFromPath(null, null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();

            returnedPackageMetadata = loader.GetPackageMetadataFromPath(string.Empty, null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();

            // Arrange
            mockFileSystem.Setup(x => x.FileExists(@"d:\myfolder\sample.nupkg")).Returns(false);

            // Act
            returnedPackageMetadata = loader.GetPackageMetadataFromPath(@"d:\myfolder\sample.nupkg", null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();
        }
示例#2
0
        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();
        }
示例#3
0
        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_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();
        }
        public void NupkgLocalPackageLoader_GetPackageMetadataFromPath_NupkgDoesNotExist()
        {
            // Arrange
            var mockFileSystem = new Mock<IFileSystem>(MockBehavior.Strict);

            // Act           
            var loader = new NupkgLocalPackageLoader(mockFileSystem.Object, null);
            var returnedPackageMetadata = loader.GetPackageMetadataFromPath(null, null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();

            returnedPackageMetadata = loader.GetPackageMetadataFromPath(string.Empty, null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();

            // Arrange
            mockFileSystem.Setup(x => x.FileExists(@"d:\myfolder\sample.nupkg")).Returns(false);

            // Act           
            returnedPackageMetadata = loader.GetPackageMetadataFromPath(@"d:\myfolder\sample.nupkg", null);

            // Assert
            Assert.IsNull(returnedPackageMetadata);
            mockFileSystem.VerifyAll();
        }