My code is currently building with no errors. It is searching in an xml file for values, and I need for it to check if the values are within a range that determines if they pass/fail. I believe I have the code right but I need the pass/fail to display on the screen. Any help?
var query = from file in fileEntries
let doc = XDocument.Load(file)
let x = doc.Descendants("XAxisCalib").Single()
let y = doc.Descendants("YAxisCalib").Single()
let z = doc.Descendants("ZAxisCalib").Single()
select new
{
XMax = x.Element("Max").Value,
XMin = x.Element("Min").Value,
YMax = y.Element("Max").Value,
YMin = y.Element("Min").Value,
ZMax = z.Element("Max").Value,
ZMin = z.Element("Min").Value
};
var results = from item in query
select new
{
XMaxResult = Convert.ToInt32(item.XMax) < 290 ? "pass" : "fail",
XMinResult = Convert.ToInt32(item.XMin) > -50 ? "pass" : "fail",
YMaxResult = Convert.ToInt32(item.YMax) < 645 ? "pass" : "fail",
YMinResult = Convert.ToInt32(item.YMin) > -87 ? "pass" : "fail",
ZMaxResult = Convert.ToInt32(item.ZMax) < 20 ? "pass" : "fail",
ZMinResult = Convert.ToInt32(item.ZMin) > -130 ? "pass" : "fail",
};
Sample Xml: (more lines but deleted for simplicity)
<XAxisCalib>
<Max>296</Max>
<Min>-51.04</Min>
</XAxisCalib>
<YAxisCalib>
<Max>640</Max>
<Min>-24.6</Min>
</YAxisCalib>
<ZAxisCalib>
<Max>29.67</Max>
<Min>-129</Min>