Beispiel #1
0
        public void ComparisonResultsAreNotEqualWhenMessageIsDifferent()
        {
            XPathNodeMatchComparisonResult lhs = new XPathNodeMatchComparisonResult(false, "aaa");
            XPathNodeMatchComparisonResult rhs = new XPathNodeMatchComparisonResult(false, "bbb");

            Assert.AreNotEqual(lhs, rhs);
        }
Beispiel #2
0
        public void ComparisonResultsAreNotEqualWhenResultIsDifferent()
        {
            XPathNodeMatchComparisonResult lhs = new XPathNodeMatchComparisonResult(false, "abc");
            XPathNodeMatchComparisonResult rhs = new XPathNodeMatchComparisonResult(true, "abc");

            Assert.AreNotEqual(lhs, rhs);
        }
Beispiel #3
0
        public void ComparisonResultsAreEqualWhenResultAndMessageAreSame()
        {
            XPathNodeMatchComparisonResult lhs = new XPathNodeMatchComparisonResult(true, "abc");
            XPathNodeMatchComparisonResult rhs = new XPathNodeMatchComparisonResult(true, "abc");

            Assert.AreEqual(lhs, rhs);
        }
        public void ResultEqualsReturnsTrueWhenXPathNodesAreSame()
        {
            XPathNodeMatch           lhs        = new XPathNodeMatch("nodeValue", "DisplayValue", 1, 2, XPathNodeType.Text);
            XPathNodeMatch           rhs        = new XPathNodeMatch("nodeValue", "DisplayValue", 1, 2, XPathNodeType.Text);
            XPathNodeMatchComparison comparison = new XPathNodeMatchComparison();

            XPathNodeMatchComparisonResult result = new XPathNodeMatchComparisonResult();

            result.Result  = comparison.AreEqual(lhs, rhs);
            result.Message = comparison.GetReasonForNotMatching();

            XPathNodeMatchComparisonResult expectedResult = new XPathNodeMatchComparisonResult(true, String.Empty);

            Assert.AreEqual(expectedResult, result);
        }
        public void ResultEqualsReturnsFalseWhenXPathNodeLinePositionsAreDifferent()
        {
            XPathNodeMatch           lhs        = new XPathNodeMatch("nodeValue", "DisplayValue", 1, 2, XPathNodeType.Text);
            XPathNodeMatch           rhs        = new XPathNodeMatch("nodeValue", "DisplayValue", 1, 3, XPathNodeType.Text);
            XPathNodeMatchComparison comparison = new XPathNodeMatchComparison();

            XPathNodeMatchComparisonResult result = new XPathNodeMatchComparisonResult();

            result.Result  = comparison.AreEqual(lhs, rhs);
            result.Message = comparison.GetReasonForNotMatching();

            string expectedReason = "LinePositions do not match. Expected '2' but was '3'.";
            XPathNodeMatchComparisonResult expectedResult = new XPathNodeMatchComparisonResult(false, expectedReason);

            Assert.AreEqual(expectedResult, result);
        }
        public void ResultEqualsReturnsFalseWhenOneXPathNodeLineNumberIsNull()
        {
            int?                     lineNumber = null;
            XPathNodeMatch           lhs        = new XPathNodeMatch("nodeValue", "DisplayValue", lineNumber, 2, XPathNodeType.Text);
            XPathNodeMatch           rhs        = new XPathNodeMatch("nodeValue", "DisplayValue", 0, 2, XPathNodeType.Text);
            XPathNodeMatchComparison comparison = new XPathNodeMatchComparison();

            XPathNodeMatchComparisonResult result = new XPathNodeMatchComparisonResult();

            result.Result  = comparison.AreEqual(lhs, rhs);
            result.Message = comparison.GetReasonForNotMatching();

            string expectedReason = "LineNumbers do not match. Expected 'null' but was '0'.";
            XPathNodeMatchComparisonResult expectedResult = new XPathNodeMatchComparisonResult(false, expectedReason);

            Assert.AreEqual(expectedResult, result);
        }
Beispiel #7
0
        public void ComparisonResultEqualsReturnsFalseForNull()
        {
            XPathNodeMatchComparisonResult result = new XPathNodeMatchComparisonResult();

            Assert.IsFalse(result.Equals(null));
        }
Beispiel #8
0
        public void ComparisonResultToString()
        {
            XPathNodeMatchComparisonResult lhs = new XPathNodeMatchComparisonResult(true, "message");

            Assert.AreEqual("Result: True, Message: 'message'", lhs.ToString());
        }