Exemplo n.º 1
0
        public void CanRemoveAssemblyBinding()
        {
            CreateFiles();
            CustomInstaller.UpdateMachineConfigs(Environment.CurrentDirectory + "\\", true);

            CustomInstaller.UpdateMachineConfigs(Environment.CurrentDirectory + "\\", false);

            string[] dirs = new string[2] {
                "v2.0.50727", "v4.0.30319"
            };

            foreach (string frameworkDir in dirs)
            {
                var configFile = Environment.CurrentDirectory + "\\" + frameworkDir + @"\CONFIG" + @"\machine.config";

                StreamReader sr        = new StreamReader(configFile);
                string       configXML = sr.ReadToEnd();
                sr.Close();

                // load the XML into the XmlDocument
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(configXML);

                XmlNodeList nodesDependantAssembly = doc.GetElementsByTagName("assemblyBinding")[0].ChildNodes;
                if (nodesDependantAssembly != null)
                {
                    int nodesCount = nodesDependantAssembly.Count;
                    for (int i = 0; i < nodesCount; i++)
                    {
                        if (nodesDependantAssembly[0].ChildNodes[0].Attributes[0].Name == "name"
                            &&
                            nodesDependantAssembly[0].ChildNodes[0].Attributes[0].Value.Contains("MySql"))
                        {
                            Assert.True(true, "Error when removing assembly binding redirection");
                        }
                    }
                }
            }

            DeleteFiles();
        }
Exemplo n.º 2
0
 public void CanAddAssemblyBinding()
 {
     CreateFiles();
     CustomInstaller.UpdateMachineConfigs(Environment.CurrentDirectory + "\\", true);
     DeleteFiles();
 }