/// <summary> /// Removes an installation. /// </summary> /// <param name="savedState"> /// An IDictionary used to save information needed to perform a commit, rollback, or uninstall operation. /// </param> public override void Uninstall(System.Collections.IDictionary savedState) { LicenseFile.Uninstall(); FileNames.DeleteKeys(); ManifestManagement.DeleteDeployManifest(); base.Uninstall(savedState); }
/// <summary> /// When overridden in a derived class, restores the pre-installation state of the computer. /// </summary> /// <param name="savedState">An <see cref="T:System.Collections.IDictionary"/> that contains the pre-installation state of the computer.</param> /// <exception cref="T:System.ArgumentException"> /// The <paramref name="savedState"/> parameter is null. /// -or- /// The saved-state <see cref="T:System.Collections.IDictionary"/> might have been corrupted. /// </exception> /// <exception cref="T:System.Configuration.Install.InstallException"> /// An exception occurred during the <see cref="M:System.Configuration.Install.Installer.Rollback(System.Collections.IDictionary)"/> phase /// of the installation. This exception is ignored and the rollback continues. /// However, the computer might not be fully reverted to its initial state after the rollback completes. /// </exception> public override void Rollback(IDictionary savedState) { LicenseFile.Uninstall(); FileNames.DeleteKeys(); ManifestManagement.DeleteDeployManifest(); base.Rollback(savedState); }
public void InstallLicenseFromContainerAllParametersTest() { try { LibInstaller.InstallLicense("user", "company", "email", true, "", "", Assembly.GetExecutingAssembly()); Assert.Fail(); } catch (Exception ex) { DeployManifest _manifest = FileNames.ProductManifest(); Assert.IsNotNull(_manifest); Assert.AreEqual <string>("CAS.CodeProtect.UnitTests", _manifest.Product); Assert.IsFalse(ex.Message.Contains("CAS.CodeProtect.UnitTests")); Assert.IsTrue(ex.Message.Contains("CodeProtect.UnitTests")); ManifestManagement.DeleteDeployManifest(); } }
public void InstallLicenseFromContainerDefaultParametersTest() { try { LibInstaller.InstallLicense(true); Assert.Fail(); } catch (Exception ex) { DeployManifest _manifest = FileNames.ProductManifest(); Assert.IsNotNull(_manifest); Assert.AreEqual <string>("CAS.CodeProtect.UnitTests", _manifest.Product); Assert.IsFalse(ex.Message.Contains("CAS.CodeProtect.UnitTests")); Assert.IsTrue(ex.Message.Contains("CodeProtect.UnitTests")); ManifestManagement.DeleteDeployManifest(); } }
public void ManifestFromAssemblyManagementWriteReadTestMethod() { FileInfo _fi = new FileInfo(FileNames.ManifestFileName); Assert.IsFalse(_fi.Exists); Assembly _thisAssembly = Assembly.GetExecutingAssembly(); ManifestManagement.WriteDeployManifest(_thisAssembly, CommonDefinitions.AssemblyProduct); _fi.Refresh(); Assert.IsTrue(_fi.Exists); DeployManifest _manifest = ManifestManagement.ReadDeployManifest(); ManifestManagement.DeleteDeployManifest(); _fi.Refresh(); Assert.IsFalse(_fi.Exists); //test the content Assert.IsNotNull(_manifest); Assert.IsTrue(_manifest.Install); Assert.AreEqual <string>("CodeProtectTests", _manifest.Product); Assert.AreEqual <string>("CAS", _manifest.Publisher); //Only in test environment Assert.AreEqual <string>("http://www.commsvr.eu/", _manifest.SupportUrl); Assert.AreEqual <string>("http://www.commsvr.eu/", _manifest.DeploymentUrl); AssemblyIdentity _id = _manifest.AssemblyIdentity; Assert.IsNotNull(_id); AssemblyName _thisName = _thisAssembly.GetName(); Assert.AreEqual <string>(_thisName.Version.ToString(), _id.Version); //FileReferences Assert.IsNotNull(_manifest.FileReferences); Assert.AreEqual <int>(1, _manifest.FileReferences.Count); FileReference _FileReference = _manifest.FileReferences[0]; Assert.AreEqual <string>(FileNames.TargetDir, _FileReference.TargetPath); Assert.AreEqual <string>("license", _FileReference.Group); Assert.IsFalse(_FileReference.IsOptional); Assert.IsTrue(_FileReference.IsDataFile); }