コード例 #1
0
        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);
        }
コード例 #2
0
 /// <summary>
 /// Reads the deploy manifest.
 /// </summary>
 /// <param name="ManifestFileName">Name of the manifest file.</param>
 /// <returns>The DeployManifest readed from XML File</returns>
 public static DeployManifest ReadDeployManifest(string ManifestFileName)
 {
     return(ManifestManagement.ReadDeployManifest(ManifestFileName));
 }