public void ElementHasNoAttributes() { XmlElement element = doc.CreateElement("File", WixNamespaceManager.Namespace); WixXmlAttributeCollection attributes = schema.GetAttributes(element); Assert.IsTrue(attributes.Count > 0); Assert.IsTrue(Object.ReferenceEquals(attributes[0].Document, doc)); }
public void UnknownElementAttribute() { XmlElement element = doc.CreateElement("File", WixNamespaceManager.Namespace); element.SetAttribute("Test", "TestValue"); WixXmlAttributeCollection attributes = schema.GetAttributes(element); Assert.IsTrue(attributes.Count > 1); Assert.IsNotNull(attributes["Test"]); }
public void ElementHasOneAttribute() { XmlElement element = doc.CreateElement("File", WixNamespaceManager.Namespace); element.SetAttribute("Id", "Test"); WixXmlAttributeCollection attributes = schema.GetAttributes(element); int idAttributeCount = 0; foreach (WixXmlAttribute attribute in attributes) { if (attribute.Name == "Id") { idAttributeCount++; } } Assert.AreEqual(1, idAttributeCount); }
public void Init() { doc = new WixDocument(); doc.FileName = @"C:\Projects\Setup\Files.wxs"; doc.LoadXml(GetWixXml()); XmlElement productElement = doc.GetProduct(); WixXmlAttributeCollection attributes = wixSchema.GetAttributes(productElement); productIdAttribute = attributes["Id"]; productUpgradeCodeAttribute = attributes["UpgradeCode"]; XmlElement componentElement = (XmlElement)doc.SelectSingleNode("//w:Component", new WixNamespaceManager(doc.NameTable)); attributes = wixSchema.GetAttributes(componentElement); componentGuidAttribute = attributes["Guid"]; componentKeyPathAttribute = attributes["KeyPath"]; XmlElement fileElement = (XmlElement)doc.SelectSingleNode("//w:File", new WixNamespaceManager(doc.NameTable)); attributes = wixSchema.GetAttributes(fileElement); fileSourceAttribute = attributes["Source"]; fileSrcAttribute = attributes["src"]; }