public void PackageExists_PackageIdentity_ReturnsFalseIfPackageDoesNotExist(bool useSideBySidePaths)
 {
     using (var test = new FolderNuGetProjectTest(useSideBySidePaths))
     {
         Assert.False(test.Project.PackageExists(test.PackageIdentity));
     }
 }
 public void PackageExists_PackageIdentityPackageSaveMode_ReturnsFalseIfNuspecDoesNotExist(
     bool useSideBySidePaths)
 {
     using (var test = new FolderNuGetProjectTest(useSideBySidePaths))
     {
         Assert.False(test.Project.PackageExists(test.PackageIdentity, PackageSaveMode.Nuspec));
     }
 }
        public void GetPackageDownloadMarkerFilePath_ReturnsNullIfFileDoesNotExist()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var filePath = test.Project.GetPackageDownloadMarkerFilePath(test.PackageIdentity);

                Assert.Null(filePath);
            }
        }
        public void PackageAndManifestExists_ReturnsFalseIfNuspecNotInstalled()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var exists = test.Project.PackageAndManifestExists(test.PackageIdentity);

                Assert.False(exists);
            }
        }
        public async Task PackageExists_PackageIdentityPackageSaveMode_ReturnsTrueIfPackageExists(bool useSideBySidePaths)
        {
            using (var test = new FolderNuGetProjectTest(useSideBySidePaths))
            {
                await test.InstallAsync(PackageSaveMode.Nupkg);

                Assert.True(test.Project.PackageExists(test.PackageIdentity, PackageSaveMode.Nupkg));
            }
        }
        public void PackageExists_PackageIdentity_ReturnsTrueIfPackageDownloadMarkerFileExists(bool useSideBySidePaths)
        {
            using (var test = new FolderNuGetProjectTest(useSideBySidePaths))
            {
                test.CreatePackageDownloadMarkerFile();

                Assert.True(test.Project.PackageExists(test.PackageIdentity));
            }
        }
        public void GetPackageDownloadMarkerFilePath_ThrowsForNullPackageIdentity()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var exception = Assert.Throws <ArgumentNullException>(
                    () => test.Project.GetPackageDownloadMarkerFilePath(packageIdentity: null));

                Assert.Equal("packageIdentity", exception.ParamName);
            }
        }
        public void PackageAndManifestExists_ThrowsForNullPackageIdentity()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var exception = Assert.Throws <ArgumentNullException>(
                    () => test.Project.PackageAndManifestExists(packageIdentity: null));

                Assert.Equal("packageIdentity", exception.ParamName);
            }
        }
        public async Task PackageExists_PackageIdentityPackageSaveMode_ReturnsTrueIfDefaultv3Installed(
            PackageSaveMode packageSaveMode)
        {
            using (var test = new FolderNuGetProjectTest())
            {
                await test.InstallAsync(packageSaveMode);

                Assert.True(test.Project.PackageExists(test.PackageIdentity, PackageSaveMode.Defaultv3));
            }
        }
 public async Task CopySatelliteFilesAsync_ThrowsIfCancelled()
 {
     using (var test = new FolderNuGetProjectTest())
     {
         await Assert.ThrowsAsync <OperationCanceledException>(
             () => test.Project.CopySatelliteFilesAsync(
                 test.PackageIdentity,
                 Mock.Of <INuGetProjectContext>(),
                 new CancellationToken(canceled: true)));
     }
 }
        public async Task PackageAndManifestExist_ReturnsTrueIfNuspecInstalled()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                await test.InstallAsync(PackageSaveMode.Nupkg | PackageSaveMode.Nuspec);

                var exists = test.Project.PackageAndManifestExists(test.PackageIdentity);

                Assert.True(exists);
            }
        }
        public void GetPackageDownloadMarkerFilePath_ReturnsFilePathIfFileExists()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                test.CreatePackageDownloadMarkerFile();

                var filePath = test.Project.GetPackageDownloadMarkerFilePath(test.PackageIdentity);

                Assert.NotNull(filePath);
                Assert.True(File.Exists(filePath));
            }
        }
        public async Task CopySatelliteFilesAsync_ThrowsForNullNuGetProjectContext()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var exception = await Assert.ThrowsAsync <ArgumentNullException>(
                    () => test.Project.CopySatelliteFilesAsync(
                        test.PackageIdentity,
                        nuGetProjectContext: null,
                        token: CancellationToken.None));

                Assert.Equal("nuGetProjectContext", exception.ParamName);
            }
        }
        public async Task DeletePackage_ThrowsForNullPackageIdentity()
        {
            using (var test = new FolderNuGetProjectTest())
            {
                var exception = await Assert.ThrowsAsync <ArgumentNullException>(
                    () => test.Project.DeletePackage(
                        packageIdentity: null,
                        nuGetProjectContext: Mock.Of <INuGetProjectContext>(),
                        token: CancellationToken.None));

                Assert.Equal("packageIdentity", exception.ParamName);
            }
        }