Example #1
0
        /// <summary>
        /// Common method to abstract the use of EvaluateXpath
        /// </summary>
        /// <param name="actualFile">File with output of the map</param>
        /// <param name="xpath">XPath to lookup</param>
        /// <param name="expectedValue">Value to compare with</param>
        /// <returns></returns>
        public static bool IsExpectedXpathValue(string actualFile, string xpath, string expectedValue)
        {
            XmlUnit.XmlInput xmlOutput       = new XmlUnit.XmlInput(File.ReadAllText(actualFile));
            XmlUnit.XPath    xp              = new XmlUnit.XPath(xpath);
            string           valueFromOutput = xp.EvaluateXPath(xmlOutput);

            return(valueFromOutput == expectedValue);
        }
Example #2
0
        /// <summary>
        /// Common method to abstract the use of Compare, to check if the actual is identical to the expected
        /// </summary>
        /// <param name="actualFile">File with output of the map</param>
        /// <param name="expectedFile">File with the expected output</param>
        /// <returns></returns>
        public static bool IsActualIdenticalToExpected(string actualFile, string expectedFile)
        {
            XmlUnit.XmlInput xmlOutput   = new XmlUnit.XmlInput(File.ReadAllText(actualFile));
            XmlUnit.XmlInput xmlExpected = new XmlUnit.XmlInput(File.ReadAllText(expectedFile));

            XmlUnit.DiffConfiguration dc   = new XmlUnit.DiffConfiguration(System.Xml.WhitespaceHandling.None);
            XmlUnit.XmlDiff           diff = new XmlUnit.XmlDiff(xmlOutput, xmlExpected, dc);

            XmlUnit.DiffResult result = diff.Compare();
            return(result.Identical);
        }