I'm automating and installation test and have to check against an XML file.
Code: Select all
<configuration>
<appSettings>
<Version>HB.2017.0</Version>
<FORMAT_VERSION>2.4</FORMAT_VERSION>
<MISC>Stuff.2014.0</MISC>
</appSettings>
</configuration>
Code: Select all
public void ValidateConfigVersionSetting()
{
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\project.exe.config");
XmlNode = new XmlNode();
XmlNode node = doc.DocumentElement.SelectSingleNode("/Version");
string nodeContent = node.InnerText;
if (nodeContent.Equals("2017.0"))
{
Report.Success("Config", "Config is correct! 2017.");
}
else
{
Report.Failure("Config", "Config is not 2017.");
}
}