コード例 #1
0
        public void UninstallTest()
        {
            IPackageBuilder packageBuilder = _container.Resolve <IPackageBuilder>();
            Stream          stream         = BuildHelloWorld(packageBuilder);

            string filename = Path.Combine(_basePath, "package.nupkg");

            using (var fileStream = File.Create(filename)) {
                stream.CopyTo(fileStream);
            }

            ZipPackage        zipPackage       = new ZipPackage(filename);
            IPackageInstaller packageInstaller = _container.Resolve <IPackageInstaller>();

            _mockedVirtualPathProvider.Setup(v => v.MapPath(It.IsAny <string>()))
            .Returns <string>(path => Path.Combine(_basePath, path.Replace("~\\", "").Replace("~/", "")));

            _mockedVirtualPathProvider.Setup(v => v.Combine(It.IsAny <string[]>()))
            .Returns <string[]>(Path.Combine);

            PackageInfo packageInfo = packageInstaller.Install(zipPackage, _basePath, _basePath);

            Assert.That(packageInfo, Is.Not.Null);
            Assert.That(Directory.Exists(Path.Combine(_basePath, "Modules/Hello.World")));
            Assert.That(File.Exists(Path.Combine(_basePath, "Modules/Hello.World/Hello.World.csproj")));

            // Uninstall and check that the installation will be gone
            packageInstaller.Uninstall(zipPackage.Id, _basePath);
            Assert.That(Directory.Exists(Path.Combine(_basePath, "Modules/Hello.World")), Is.False);
        }
コード例 #2
0
 public void UninstallPackage(string packageId)
 {
     _packageInstaller.Uninstall(packageId, _hostEnvironment.MapPath("~/"));
 }
コード例 #3
0
 public void Uninstall(string packageId, string applicationPath)
 {
     _packageInstaller.Uninstall(packageId, applicationPath);
 }